架构发生倍数(例如2倍)倍的XML,总是失败给人错误的“架构有效性错误:元素‘名’:不期望这个元素”的元素。 “名”是XML文件,即中间的元素,我们在XML等元素和“名”成为XML文件的中旬。 XML文件有适当的标题为“”
Sample "name" element in XML file :
<name>
<First>1</First>
<last>1</last>
</name>
<name>
<First>1</First>
<last>1</last>
</name>
Sample Schema tried as below, but nothing works. However after commenting the second instance of "name" in XML, schema is validated successfully. PLEASE HELP.
<xs:element name="name" >
<xs:complexType mixed="true">
<xs:sequence>
<xs:element ref="First"/>
<xs:element ref="last"/>
<xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name" >
<xs:complexType mixed="true">
<xs:sequence minOccurs="1" maxOccurs="3">
<xs:element ref="First"/>
<xs:element ref="last"/>
<xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name" >
<xs:complexType mixed="true">
<xs:all>
<xs:element ref="First"/>
<xs:element ref="last"/>
<xs:all>
</xs:complexType>
</xs:element>
<xs:element name="name" minOccurs="1" maxOccurs="3" >
<xs:complexType mixed="true">
<xs:sequence >
<xs:element ref="First"/>
<xs:element ref="last"/>
<xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name">
<xs:complexType mixed="true">
<xs:choice maxOccurs="3" >
<xs:element ref="First"/>
<xs:element ref="last"/>
<xs:choice>
</xs:complexType>
</xs:element>