怎样在ASP中构造ClientDataSet的XML数据流 --(一行大师)(100分)

  • 主题发起人 主题发起人 wzs
  • 开始时间 开始时间
??????????????
 
能说清楚些吗?
 
ClientDataSet 保存的XML数据流格式 :
------------------------------------------------
?xml version="1.0" standalone="yes"?>
<DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="LAST_NAME" fieldtype="string" WIDTH="20"/>
<FIELD attrname="FIRST_NAME" fieldtype="string" WIDTH="20"/>
<FIELD attrname="ACCT_NBR" fieldtype="r8"/>
<FIELD attrname="ADDRESS_1" fieldtype="string" WIDTH="20"/>
<FIELD attrname="CITY" fieldtype="string" WIDTH="20"/>
<FIELD attrname="STATE" fieldtype="string" WIDTH="2"/>
<FIELD attrname="ZIP" fieldtype="string" WIDTH="5"/>
<FIELD attrname="TELEPHONE" fieldtype="string" WIDTH="12"/>
<FIELD attrname="DATE_OPEN" fieldtype="date"/>
<FIELD attrname="SS_NUMBER" fieldtype="r8"/>
<FIELD attrname="PICTURE" fieldtype="string" WIDTH="15"/>
<FIELD attrname="BIRTH_DATE" fieldtype="date"/>
<FIELD attrname="RISK_LEVEL" fieldtype="string" WIDTH="8"/>
<FIELD attrname="OCCUPATION" fieldtype="string" WIDTH="20"/>
<FIELD attrname="OBJECTIVES" fieldtype="string" WIDTH="10"/>
<FIELD attrname="INTERESTS" fieldtype="string" WIDTH="120"/>
<FIELD attrname="IMAGE" fieldtype="bin.hex" SUBTYPE="TypedBinary" WIDTH="1"/>
</FIELDS>
<PARAMS LCID="0"/>
</METADATA>
<ROWDATA>
<ROW LAST_NAME="Davis" FIRST_NAME="Jennifer" ACCT_NBR="1023495" ADDRESS_1="100 Cranberry St." CITY="Wellesley" STATE="MA" ZIP="02181" TELEPHONE="516-292-3945" DATE_OPEN="19930101" SS_NUMBER="405309771" PICTURE="cus1.bmp" BIRTH_DATE="19600715" RISK_LEVEL="MED" OCCUPATION="Programmer" OBJECTIVES="Growth" INTERESTS="Enjoys horseback riding and paints."/>
<ROW LAST_NAME="Jones" FIRST_NAME="Arthur" ACCT_NBR="2094056" ADDRESS_1="10 Hunnewell St" CITY="Los Altos" STATE="CA" ZIP="94024" TELEPHONE="415-941-4321" DATE_OPEN="19810207" SS_NUMBER="320345889" PICTURE="cus2.bmp" BIRTH_DATE="19500210" RISK_LEVEL="HIGH" OCCUPATION="Doctor" OBJECTIVES="Income" INTERESTS="Has five children. Loves to travel."/>
<ROW LAST_NAME="Parker" FIRST_NAME="Debra" ACCT_NBR="1209395" ADDRESS_1="74 South St" CITY="Atherton" STATE="CA" ZIP="98765" TELEPHONE="916-213-2234" DATE_OPEN="19901023" SS_NUMBER="102348778" PICTURE="cus3.bmp" BIRTH_DATE="19571010" RISK_LEVEL="LOW" OCCUPATION="Restauranteur" OBJECTIVES="Growth" INTERESTS="Has own company."/>
<ROW LAST_NAME="Sawyer" FIRST_NAME="Dave" ACCT_NBR="3094095" ADDRESS_1="101 Oakland St" CITY="Los Altos" STATE="CA" ZIP="94022" TELEPHONE="415-948-9998" DATE_OPEN="19891221" SS_NUMBER="345335576" PICTURE="cus4.bmp" BIRTH_DATE="19301010" RISK_LEVEL="HIGH" OCCUPATION="Retired" OBJECTIVES="Retirement" INTERESTS="Retired. Enjoys travel and bungee jumping."/>
<ROW LAST_NAME="White" FIRST_NAME="Cindy" ACCT_NBR="1024034" ADDRESS_1="1 Wentworth Dr" CITY="Los Altos" STATE="CA" ZIP="94022" TELEPHONE="415-948-6547" DATE_OPEN="19921001" SS_NUMBER="303459550" PICTURE="cus5.bmp" BIRTH_DATE="19560313" RISK_LEVEL="MED" OCCUPATION="Engineer" OBJECTIVES="Growth" INTERESTS="Enjoys fishing, skiing, and skydiving."/>
</ROWDATA>
</DATAPACKET>
---------------------------------
ASP 如何构造该XML数据????
 
是指在delphi中吗?
用xmlbroker吧
 
<body>
<p>ClientDataSet 保存的XML数据流格式 :<br>
------------------------------------------------<br>
&amp;lt;?xml version="1.0" standalone="yes"?>&amp;nbsp;<br>
&amp;lt;DATAPACKET Version="2.0"><br>
&amp;lt;METADATA><br>
&amp;lt;FIELDS><br>
&amp;lt;FIELD attrname="LAST_NAME" fieldtype="string" WIDTH="20"/><br>
&amp;lt;FIELD attrname="FIRST_NAME" fieldtype="string" WIDTH="20"/><br>
&amp;lt;FIELD attrname="ACCT_NBR" fieldtype="r8"/><br>
&amp;lt;FIELD attrname="ADDRESS_1" fieldtype="string" WIDTH="20"/><br>
&amp;lt;FIELD attrname="CITY" fieldtype="string" WIDTH="20"/><br>
&amp;lt;FIELD attrname="STATE" fieldtype="string" WIDTH="2"/><br>
&amp;lt;FIELD attrname="ZIP" fieldtype="string" WIDTH="5"/><br>
&amp;lt;FIELD attrname="TELEPHONE" fieldtype="string" WIDTH="12"/><br>
&amp;lt;FIELD attrname="DATE_OPEN" fieldtype="date"/><br>
&amp;lt;FIELD attrname="SS_NUMBER" fieldtype="r8"/><br>
&amp;lt;FIELD attrname="PICTURE" fieldtype="string" WIDTH="15"/><br>
&amp;lt;FIELD attrname="BIRTH_DATE" fieldtype="date"/><br>
&amp;lt;FIELD attrname="RISK_LEVEL" fieldtype="string" WIDTH="8"/><br>
&amp;lt;FIELD attrname="OCCUPATION" fieldtype="string" WIDTH="20"/><br>
&amp;lt;FIELD attrname="OBJECTIVES" fieldtype="string" WIDTH="10"/><br>
&amp;lt;FIELD attrname="INTERESTS" fieldtype="string" WIDTH="120"/><br>
&amp;lt;FIELD attrname="IMAGE" fieldtype="bin.hex" SUBTYPE="TypedBinary" WIDTH="1"/><br>
&amp;lt;/FIELDS><br>
&amp;lt;PARAMS LCID="0"/><br>
&amp;lt;/METADATA><br>
&amp;lt;ROWDATA><br>
&amp;lt;ROW LAST_NAME="Davis" FIRST_NAME="Jennifer" ACCT_NBR="1023495" ADDRESS_1="100 Cranberry St." CITY="Wellesley" STATE="MA" ZIP="02181" TELEPHONE="516-292-3945" DATE_OPEN="19930101" SS_NUMBER="405309771" PICTURE="cus1.bmp" BIRTH_DATE="19600715" RISK_LEVEL="MED" OCCUPATION="Programmer" OBJECTIVES="Growth" INTERESTS="Enjoys horseback riding and paints."/><br>
&amp;lt;ROW LAST_NAME="Jones" FIRST_NAME="Arthur" ACCT_NBR="2094056" ADDRESS_1="10 Hunnewell St" CITY="Los Altos" STATE="CA" ZIP="94024" TELEPHONE="415-941-4321" DATE_OPEN="19810207" SS_NUMBER="320345889" PICTURE="cus2.bmp" BIRTH_DATE="19500210" RISK_LEVEL="HIGH" OCCUPATION="Doctor" OBJECTIVES="Income" INTERESTS="Has five children. Loves to travel."/><br>
&amp;lt;ROW LAST_NAME="Parker" FIRST_NAME="Debra" ACCT_NBR="1209395" ADDRESS_1="74 South St" CITY="Atherton" STATE="CA" ZIP="98765" TELEPHONE="916-213-2234" DATE_OPEN="19901023" SS_NUMBER="102348778" PICTURE="cus3.bmp" BIRTH_DATE="19571010" RISK_LEVEL="LOW" OCCUPATION="Restauranteur" OBJECTIVES="Growth" INTERESTS="Has own company."/><br>
&amp;lt;ROW LAST_NAME="Sawyer" FIRST_NAME="Dave" ACCT_NBR="3094095" ADDRESS_1="101 Oakland St" CITY="Los Altos" STATE="CA" ZIP="94022" TELEPHONE="415-948-9998" DATE_OPEN="19891221" SS_NUMBER="345335576" PICTURE="cus4.bmp" BIRTH_DATE="19301010" RISK_LEVEL="HIGH" OCCUPATION="Retired" OBJECTIVES="Retirement" INTERESTS="Retired. Enjoys travel and bungee jumping."/><br>
&amp;lt;ROW LAST_NAME="White" FIRST_NAME="Cindy" ACCT_NBR="1024034" ADDRESS_1="1 Wentworth Dr" CITY="Los Altos" STATE="CA" ZIP="94022" TELEPHONE="415-948-6547" DATE_OPEN="19921001" SS_NUMBER="303459550" PICTURE="cus5.bmp" BIRTH_DATE="19560313" RISK_LEVEL="MED" OCCUPATION="Engineer" OBJECTIVES="Growth" INTERESTS="Enjoys fishing, skiing, and skydiving."/><br>
&amp;lt;/ROWDATA><br>
&amp;lt;/DATAPACKET><br>
---------------------------------<br>
ASP 如何构造该XML数据????</p>

</body>
 
dom?
哎呀,没人关注!!
 
这个问题很难吗?
这只是一个简单的字符串问题。
在ADO中可以取出一个数据集的字段名称,字段类型,字段长度,字段内容等
根据这些信息完全可以生成你所需要的XML数据流。
下面给出部分代码供你参考
.
.
.
For Each Fld In Record_Set.Fields
select case Fld.Type
Case adChar,adBStr,adVarChar
XmlField=XmlField+'<FIELD attrname="' &amp;
Fld.Name &amp;
'" fieldtype="string" WIDTH="' &amp;
Fld.DefineSize &amp;'"/>'
Case ...
.
.
End Select
XmlField=XmlField &amp;
vbCR
Next
While Not Record_Set.EOF
For Each Fld In Record_Set.Fields
select case Fld.Type
Case adChar,adBStr,adVarChar
RowValue=RowValue &amp;
' <ROW '&amp;
Fld.Name &amp;
'="' &amp;
Fld.Value '"'
Case ...
.
.
End Select
RowValue=RowValue &amp;
'/>'
Next
RowValue=RowValue &amp;
vbCR
Record_Set.MoveNext
WEnd
 
类型太多,不好判断!
我想的是能否有类似的DOM方式!!!
 
你可以用 Delphi 编写 ASP 组件来构造数据驱动的 XML,挺简单的。
 
是没错,但不想,也不能用这种方式
 
关注。。。。
 
asp好象有ms提供的xml对象,可以用来处理xml的
 
提前一下!
 
我用一个xsl将 ado.recordset 生成的 xml 转化成 clientdataset的xml数据结构,
这样 clientdataset 就可以用了。
 
后退
顶部