Schema xs:unique is not being validated

soulcan

New Member
I have a simple xml file\[code\]<form xmlns="http://www.example.org/form-reader/form-description"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.example.org/form-reader/form-description form-description.xsd"> <pages amount="1"/> <pages amount="1"/></form>\[/code\]And i wrote schema for it\[code\]<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.example.org/form-reader/form-description"xmlns="http://www.example.org/form-reader/form-description"elementFormDefault="qualified"> <xs:complexType name="pagesType"> <xs:attribute name="amount" type="xs:string" use="required" /> </xs:complexType> <xs:complexType name="formType"> <xs:sequence minOccurs="1"> <xs:element name="pages" minOccurs="0" maxOccurs="unbounded" type="pagesType" /> </xs:sequence> </xs:complexType> <xs:element name="form" type="formType"> <xs:unique name="pageNumberUnique"> <xs:selector xpath="pages" /> <xs:field xpath="@amount" /> </xs:unique> </xs:element></xs:schema>\[/code\]I want to validate uniqness of amount property, but in all validators, my xml file seems valid and it shouldn't, why?
 
Back
Top