XSD validation on the sequence of attributes.

Posted by infant programmer on Stack Overflow See other posts from Stack Overflow or by infant programmer
Published on 2010-03-09T06:14:48Z Indexed on 2010/03/09 6:21 UTC
Read the original article Hit count: 301

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about xsd

Related posts about xsd-validation