我有以下XML
<SourceDataSet xmlns="C:/Users/AGARWALN/Desktop/NidhiTest/SourceDataSet.xsd">
<SourceSystem>
<SystemCode>XTRADER</SystemCode>
</SourceSystem>
和xsd为
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:mstns="C:/Users/AGARWALN/Desktop/NidhiTest/SourceDataSet.xsd" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns="C:/Users/AGARWALN/Desktop/NidhiTest/SourceDataSet.xsd" attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="C:/Users/AGARWALN/Desktop/NidhiTest/SourceDataSet.xsd" id="SourceDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element msdata:IsDataSet="true" msdata:UseCurrentLocale="true" name="SourceDataSet">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="SourceSystem">
<xs:complexType>
<xs:sequence>
<xs:element name="SystemCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="PK_SourceSystem">
<xs:selector xpath="SourceDataSet/SourceSystem"/>
<xs:field xpath="SystemCode"/></xs:key>
</xs:element>
</xs:schema>
除主键验证外,所有验证都有效。它全部使用http://www.w3schools.com/schema/schema_schema.asp
中给出的默认命名空间感谢您提前提供任何帮助..
答案 0 :(得分:0)
它是xml和xsd文件的真实表示吗? 您是否已关闭xml“SourceDataSet”标记和“xs:sequence”,“xs:complexType”,“xs:element”xsd标记?