我们以前这样做过。首先用xml传递数据是正确的,不能用自定义类型,因为delphi不认识。
其次确实需要把java的resultset产生的xml和delphi的CDS需要的xml格式之间进行转换,转换的方式可以用XSLT。

解决方案 »

  1.   

    infowain(infowain),您好,非常谢谢您能帮我分析该问题。
    可是我对XSLT转换两个不同格式的xml文件的实现方式不熟悉,用google搜索了一下相关内容也不能找到解决方案,能不能再麻烦您告诉我一下转换的具体思路?谢谢。
    例如,我要将a.xml文件
     <?xml version="1.0" encoding="UTF-8" ?> 
    - <xhtml:result xmlns:xhtml="http://w3.org/etc">
    - <xhtml:entry some4="Sales Representative">
      <xhtml:EmployeeID>1</xhtml:EmployeeID> 
      <xhtml:LastName>Davolio</xhtml:LastName> 
      <xhtml:num3>Nancy</xhtml:num3> 
      <xhtml:TitleOfCourtesy>Ms.</xhtml:TitleOfCourtesy> 
      <xhtml:BirthDate>1948年12月8日 星期三 上午12时00分00秒 CST</xhtml:BirthDate> 
      <xhtml:HireDate>1992年5月1日 星期五 上午12时00分00秒 CST</xhtml:HireDate> 
      <xhtml:Address>507 - 20th Ave. E. Apt. 2A</xhtml:Address> 
      <xhtml:City>Seattle</xhtml:City> 
      <xhtml:Region>WA</xhtml:Region> 
      <xhtml:PostalCode>98122</xhtml:PostalCode> 
      <xhtml:Country>USA</xhtml:Country> 
      <xhtml:HomePhone>(206) 555-9857</xhtml:HomePhone> 
      <xhtml:Extension>5467</xhtml:Extension> 
      <xhtml:Notes>Education includes a BA in psychology from Colorado State University in 1970. She also completed "The Art of the Cold Call." Nancy is a member of Toastmasters International.</xhtml:Notes> 
      <xhtml:ReportsTo>2</xhtml:ReportsTo> 
      <xhtml:PhotoPath>http://accweb/emmployees/davolio.bmp</xhtml:PhotoPath> 
      </xhtml:entry>
      </xhtml:result>
    转换为b.xml文件
    <?xml version="1.0" standalone="yes"?>
    <DATAPACKET Version="2.0">
    <METADATA>
    <FIELDS>
    <FIELD attrname="EmployeeID" fieldtype="i4" readonly="true" SUBTYPE="Autoinc"/>
    <FIELD attrname="LastName" fieldtype="string.uni" WIDTH="40"/>
    <FIELD attrname="FirstName" fieldtype="string.uni" WIDTH="20"/>
    <FIELD attrname="Title" fieldtype="string.uni" WIDTH="60"/>
    <FIELD attrname="TitleOfCourtesy" fieldtype="string.uni" WIDTH="50"/>
    <FIELD attrname="BirthDate" fieldtype="dateTime"/>
    <FIELD attrname="HireDate" fieldtype="dateTime"/>
    <FIELD attrname="Address" fieldtype="string.uni" WIDTH="120"/>
    <FIELD attrname="City" fieldtype="string.uni" WIDTH="30"/>
    <FIELD attrname="Region" fieldtype="string.uni" WIDTH="30"/>
    <FIELD attrname="PostalCode" fieldtype="string.uni" WIDTH="20"/>
    <FIELD attrname="Country" fieldtype="string.uni" WIDTH="30"/>
    <FIELD attrname="HomePhone" fieldtype="string.uni" WIDTH="48"/>
    <FIELD attrname="Extension" fieldtype="string.uni" WIDTH="8"/>
    <FIELD attrname="Notes" fieldtype="bin.hex" SUBTYPE="Text"/>
    <FIELD attrname="ReportsTo" fieldtype="i4"/>
    <FIELD attrname="PhotoPath" fieldtype="string.uni" WIDTH="510"/>
    </FIELDS>
    <PARAMS/>
    </METADATA>
    <ROWDATA>
    <ROW EmployeeID="1" LastName="Davolio" FirstName="Nancy" Title="Sales Representative" TitleOfCourtesy="Ms." BirthDate="19481208" HireDate="19920501" Address="507 - 20th Ave. E.&#013;&#010;Apt. 2A" City="Seattle" Region="WA" PostalCode="98122" Country="USA" HomePhone="(206) 555-9857" Extension="5467" Notes="Education includes a BA in psychology from Colorado State University in 1970.  She also completed &quot;The Art of the Cold Call.&quot;  Nancy is a member of Toastmasters International." ReportsTo="2" PhotoPath="http://accweb/emmployees/davolio.bmp"/>
    </ROWDATA>
    </DATAPACKET>
      

  2.   

    两个xml文件进行转换时,如果有图片之类的block数据,两个xml文件编码不一样,通过xslt转换后还能正确识别吗?谢谢
      

  3.   

    对于图片之类的数据,你可以用CDATA