XML generation in JAVA

61 views Asked by At

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

1

There are 1 answers

0
umesh shukla On

Please look into this answer

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

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