2010-08-02 17 views

cevap

23

şey çalışmalıdır:

<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> 

Temel olarak, bir <xs:unique> öğesini kullanarak bir "teklik" kısıtlamayı tanımlamak ve bu tekliği için geçerli gerektiğini XPath tanımlayabilirsiniz.

Bkz W3Schools' entry on <xs:unique> fazla bilgi için.

0

Not: Farklı ad alanları varsa Bu çalışmıyor. Sonra tam XPath ifadesini gerekir:

Bu olabilir gibi:

<xs:unique name="unique-isbn"> 
     <xs:selector xpath="theOtherNamespace:book"/> 
     <xs:field xpath="@isbn"/> 
</xs:unique> 
İlgili konular