Sunday, 2 November 2014

XSD Uniq constraint issue



I have an issue with enforcing the uniq constraint on "BookName" in the following XSD. Can someone please let me know what is the issue and why it is not working.





<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://ift.tt/1DKET5S"
xmlns="http://ift.tt/1DKET5S"
xmlns:mstns="http://ift.tt/1DKET5S"
xmlns:xs="http://ift.tt/tphNwY">
<xs:element name="xmlExtraction">
<xs:complexType>
<xs:sequence>
<xs:element name="BooksNode" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" minOccurs="1" name="BookStoreName"/>
<xs:element name="bookNode" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" type="xs:string" name="BookName"/>
<xs:element minOccurs="1" type="xs:byte" name="versionNumber"/>
<xs:element minOccurs="1" type="xs:string" name="AuthorName"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueBookName">
<xs:selector xpath="mstns:bookNode"/>
<xs:field xpath="BookName"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>



I am unable to enforce the uniq constraint on the bookname can someone please paste the full xsd which enforces the constraint.


Thanks a lot for your help


No comments:

Post a Comment