gpt4 book ai didi

XML 映射器... XE2

转载 作者:行者123 更新时间:2023-12-03 18:50:51 24 4
gpt4 key购买 nike

我有一个来自 web 服务的 xml,我想将它存储在 ClientDataSet 中。

使用 XML 映射器时,网格中不显示任何数据(使用
“创建和测试转换”),所以我无法使用
转换文件...

这是来自 C# Webservice 的一些响应 XML(一行数据)...

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<AllResponse xmlns="http://some.url.com/">
<AllResult>
<xs:schema xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="NewDataSet">
<xs:element msdata:UseCurrentLocale="true" msdata:IsDataSet="true" name="NewDataSet">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" minOccurs="0" type="xs:string"/>
<xs:element name="UserName" minOccurs="0" type="xs:string"/>
<xs:element name="Name" minOccurs="0" type="xs:string"/>
<xs:element name="PhoneInt" minOccurs="0" type="xs:string"/>
<xs:element name="CostCentre" minOccurs="0" type="xs:int"/>
<xs:element name="GroupRoleNameDK" minOccurs="0" type="xs:string"/>
<xs:element name="GroupRoleNameUK" minOccurs="0" type="xs:string"/>
<xs:element name="Email" minOccurs="0" type="xs:string"/>
<xs:element name="Url" minOccurs="0" type="xs:string"/>
<xs:element name="PhoneAlt" minOccurs="0" type="xs:string"/>
<xs:element name="PhoneMobile" minOccurs="0" type="xs:string"/>
<xs:element name="Fax" minOccurs="0" type="xs:string"/>
<xs:element name="EducationNameDK" minOccurs="0" type="xs:string"/>
<xs:element name="EducationNameUK" minOccurs="0" type="xs:string"/>
<xs:element name="Location" minOccurs="0" type="xs:string"/>
<xs:element name="PhoneNote" minOccurs="0" type="xs:string"/>
<xs:element name="Personid" minOccurs="0" type="xs:int"/>
<xs:element name="GroupId" minOccurs="0" type="xs:int"/>
<xs:element name="GroupNameDK" minOccurs="0" type="xs:string"/>
<xs:element name="GroupNameUK" minOccurs="0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<Id>P-4</Id>
<UserName>auser</UserName>
<Name>Somename</Name>
<PhoneInt>aPhone</PhoneInt>
<CostCentre>0</CostCentre>
<GroupRoleNameDK>WebService</GroupRoleNameDK>
<GroupRoleNameUK>WebService</GroupRoleNameUK>
<Email>aname@acompany.com</Email>
<Url>http://www.embarcadero.com</Url>
<PhoneMobile>12345678</PhoneMobile>
<Fax>87654321</Fax>
<Personid>4</Personid>
<GroupId>618</GroupId>
<GroupNameDK>Danish Group</GroupNameDK>
<GroupNameUK>GroupName</GroupNameUK>
</Table>
</NewDataSet>
</diffgr:diffgram>
</AllResult>
</AllResponse>
</soap:Body>
</soap:Envelope>

架构似乎定义得很好,所以我有点困惑,为什么
不起作用。
我注意到有些字段有 而不是
当字段为空时 - 不知道这是否重要......

知道我是怎么相处的吗?

-库尔特

最佳答案

响应包含两部分,一个类似于 XSD 文档中的 XML 模式定义和一个数据部分。

如果 XE2 中的 XML 数据绑定(bind)向导不喜欢这种格式,我会

  • 提取模式部分(一次)并从中创建一个可以由向导处理的 XSD
  • 从 XML 文档中提取数据部分(针对每个响应)并将其提供给转换组件
  • 关于XML 映射器... XE2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8654462/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com