"1" is a valid string, so the check does not return an error. If you want to specify some kind of restriction (for example, "id must begin with a letter"), you must declare your type and specify a pattern:
<xsd:simpleType name="myID"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[a-zA-Z].*"/> </xsd:restriction> </xsd:simpleType> .... <xsd:attribute name="id" type="myID"/> ....
If you want to specify a unique constraint, you can use the xsd: unique element as follows:
<xsd:element name="root" type="myList"> <xsd:unique name="myId"> <xsd:selector xpath="./a"/> <xsd:field xpath="@id"/> </xsd:unique> </xsd:element>
This means that the root element declared as some kind of "myList" must contain subelements "a" with unique attributes "id"
Alexey Pomelov
source share