Minidom XML output - attributes in wrong order ?

Maxim Sloyko m.sloyko at
Tue Sep 5 08:58:57 EDT 2006

> So it seems the dom module sorts the attributes alphabetically. Is there any
> way I can prevent it from doing that ? What I want is to list them out in
> the same order as they are added in the code...

I don't know how to do what you ask, I'm just here to warn you that you
shouldn't rely on the order of attributes in the document in any way,
because this is implementation dependent.

If you need to preserve order of some items -- use child elements
instead of attributes.

Regards, Maxim Sloyko

More information about the Python-list mailing list