XSD validation on the sequence of attributes.
- by infant programmer
How to validate the sequence of attributes?
In my sample XML:
<root id1="1" id2="2" id3="3" id4="">
<node/>
</root>
the appearance of attributes of root must come in same order as written above, however the xsd what I have written accepts the attributes in any order, here is the XSD:
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="node" />
</xs:sequence>
<xs:attributeGroup ref="attt"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attt">
<xs:attribute name="id1" type="xs:string" use="required" form="qualified"/>
<xs:attribute name="id2" type="xs:string" use="required" form="qualified"/>
<xs:attribute name="id3" type="xs:string" use="required" form="qualified"/>
<xs:attribute name="id4" type="xs:string" use="required" form="qualified"/>
</xs:attributeGroup>
Is it possible to put restriction on the sequence of attribute?