Atributes in XML can appear in any order (i.e. attributes are not ordered). AFAIK, the internal data structure Xerces 1 uses to keep attributes orders them alphabetically, so that is how the DOM is serialized. The XML way (so to speak) to ensure a particular order of "things" is to make them elements. Another option would be to use a "custom" element, which keeps extra information about the order of attributes...

Malia Zaheer wrote:

Hi,

I am trying to add 3 attributes to an element in this order:

e.setAttribute("ref", "record"); e.setAttribute("minOccurs", "1");
e.setAttribute("maxOccurs", "unbounded");


Later, when I try to serialize my dom tree, the attributes seem to be added
in alphabetical order of the attribute name, like this:

     <element maxOccurs='unbounded' minOccurs='1' ref="record"/>

Why does xerces change the order of attributes?  Is there anyway to force
order of attributes?

thanks for your help in advance,
Malia





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to