You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Vassil Peytchev <mu...@bobson.net> on 2002/02/11 04:58:47 UTC
Re: why does xerces add attributes in alphabetical order of attribute name
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: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org