像这样的东西应该有效:
<xs:element name="books" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="book" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="isbn" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="unique-isbn">
<xs:selector xpath="book"/>
<xs:field xpath="@isbn"/>
</xs:unique>
</xs:element>
基本上,您可以使用定义“唯一性”约束<xs:unique>
元素并定义此唯一性应应用于什么 XPath。
请参阅 W3Schools 的进入<xs:unique> http://www.w3schools.com/xml/el_unique.asp了解更多信息。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)