【发布时间】:2014-07-24 15:50:00
【问题描述】:
我是一个标准的Schema格式如下
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://HR_XML_BizTalk_Project_Schemas.Schema1" targetNamespace="http://HR_XML_BizTalk_Project_Schemas.Schema1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="UserDetails">
<xs:complexType>
<xs:sequence>
<xs:element name="Any">
<xs:complexType />
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
但我的伙伴以以下格式发送 xml。
<ns0:Root xmlns:ns0="http://HR_XML_BizTalk_Project_Schemas.Schema1">
<UserDetails>
<ID>ID_0</ID>
<Name>Name_0</Name>
<Account>Account_0</Account>
<Amount>Amount_0</Amount>
</UserDetails>
</ns0:Root>
我收到的错误是 “元素 'UserDetails' 的子元素 'ID' 无效。预期的可能元素列表:'Any'”
根据我的理解,我必须告诉我的伙伴不要在 UserDetails Record 下发送任何数据。
否则,如果在验证之前 UserDetails 记录下存在任何内容,我必须删除节点。
有没有其他方法可以解决这个问题?
【问题讨论】:
标签: c# xml xsd biztalk xml-validation