-1

I have schema like below

<xs:element name="Section">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="Class" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="WorkSpaceFolder" type="xs:string"></xs:attribute>
        <xs:attribute name="name" type="xs:string"></xs:attribute>
    </xs:complexType>
</xs:element>

But when I generate XML I get

Section name="xxxxxx" WorkSpaceFolder="xxxxxx"

But I want "WorkSpaceFolder" before "name".

e.g. Section WorkSpaceFolder="xxxxxx" name="xxxxxx"

Any suggestion how to do ?

Thanks

  • 4
    How are you generating the XML? --- If **DOM**, then you cannot, see e.g. [Order of XML attributes after DOM processing](https://stackoverflow.com/q/726395/5221149). --- If JAXB, see [JAXB Compiler and Attribute Order](https://stackoverflow.com/q/1821714/5221149). – Andreas Oct 01 '18 at 17:01

1 Answers1

0

Please look into this answer

https://stackoverflow.com/a/1682209/4491457

I think you can not specify order of element's attribute

umesh shukla
  • 139
  • 3
  • 13