attribute reordering
Posted: Tue Aug 12, 2003 4:09 am
I am having a problem where I have lots of elements that have only attribute children. The problem is that when i pretty-print the xml document, Oxygen reorders the attributes. I know that technically attributes aren't ordered, but as a matter of practice, it is extremely disconcerting to the developer if important attributes like id or name are not where they were when the developer created the elements.
i.e., I have the following elements:
<Transition input="approve" nextState="4" description="submitted document is approved"/>
<Transition input="return" nextState="3" description="submitted document was returned for modifications"/>
<Transition input="reject" nextState="6" description="submitted document was rejected"/>
The input attribute serves as the id for the transition, and in order to find a particular Transition element, I scan for the transition that has a particular input attribute value.
If I pretty-print the document this is from, it ends up like:
<Transition description="submitted document is approved" input="approve" nextState="4"/>
<Transition description="submitted document was returned for modifications" input="return" nextState="3"/>
<Transition description="submitted document was rejected" input="reject" nextState="6"/>
You can imagine that if the description were long, or there were 10 or so attributes, it would be very difficult to find the Transition that has a particular input.
In short, while attribute order doesn't matter to a parser, it is at times extremely important to authors of XML documents, since the first attribute often serves as an identifier for the element. In fact, for many of the documents that we are creating, we cannot use Oxygen's pretty print feature, since the documents become unreadable.
Have I missed some way to configure this in Oxygen (I'm using latest version), or have you thought of maintaining the order of attributes, or at least providing this an option?
i.e., I have the following elements:
<Transition input="approve" nextState="4" description="submitted document is approved"/>
<Transition input="return" nextState="3" description="submitted document was returned for modifications"/>
<Transition input="reject" nextState="6" description="submitted document was rejected"/>
The input attribute serves as the id for the transition, and in order to find a particular Transition element, I scan for the transition that has a particular input attribute value.
If I pretty-print the document this is from, it ends up like:
<Transition description="submitted document is approved" input="approve" nextState="4"/>
<Transition description="submitted document was returned for modifications" input="return" nextState="3"/>
<Transition description="submitted document was rejected" input="reject" nextState="6"/>
You can imagine that if the description were long, or there were 10 or so attributes, it would be very difficult to find the Transition that has a particular input.
In short, while attribute order doesn't matter to a parser, it is at times extremely important to authors of XML documents, since the first attribute often serves as an identifier for the element. In fact, for many of the documents that we are creating, we cannot use Oxygen's pretty print feature, since the documents become unreadable.
Have I missed some way to configure this in Oxygen (I'm using latest version), or have you thought of maintaining the order of attributes, or at least providing this an option?