XML parser that sorts elements?

jmike at alum.mit.edu jmike at alum.mit.edu
Fri Sep 22 12:02:49 EDT 2006


Diez B. Roggisch wrote:

> You can sort them by obtaining them as tree of nodes, e.g. using element
> tree or minidom.
>
> But you should be aware that this will change the structure of your document
> and it isn't always desirable to do so - e.g. html pages would look funny
> to say the least if sorted in that way.
>
> Diez

In this particular case, I need to sort the elements, and the specific
application I'm testing guarantees that the order of the elements "in
the same scope" (this may not be the right term in XML semantics, but
it's what I know how to say) does not matter.  That probably means that
the specific application I'm testing is not using XML in a standard
way, but so be it.

I'm looking at minidom now and I think maybe there's enough
documentation there that I can get a handle on it and do what I need to
do.  Thanks.  (But if anyone else has a specific example I can crib
from, that'd be great.)

--JMike




More information about the Python-list mailing list