如何使xml模式中的属性唯一?

我想使一个元素的属性像主键一样是唯一的.怎么做呢
这样的事情应该有效:
<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 entry on <xs:unique>.

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念