[Patches] [ python-Patches-1356571 ] Sort nodes when writing to file

SourceForge.net noreply at sourceforge.net
Mon Nov 14 17:56:18 CET 2005


Patches item #1356571, was opened at 2005-11-14 14:58
Message generated for change (Settings changed) made by effbot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1356571&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: XML
Group: Python 2.4
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Johan Ström (jstrom)
Assigned to: Nobody/Anonymous (nobody)
Summary: Sort nodes when writing to file

Initial Comment:
Regarding xml/dom/minidom.py

Noticed that the minidom's writer functions sorted the
attributes, but not the nodes, when writing (to file or
other). This resulted in XML files having nodes in
different order each time it was written (or at least
not sorted, in OSX the nodes came in different order
each time).
This could maybe be a problem with ie. files that seemd
to change when there realy isn't any content changes.
If not, its just better looking to have them sorted.
Wrote a patch for it if anyone wants to use it or add
it to the repository. Can't say that I've done any
extensive testing tho, if anyone sees any problems with
it, please tell!

----------------------------------------------------------------------

>Comment By: Fredrik Lundh (effbot)
Date: 2005-11-14 17:56

Message:
Logged In: YES 
user_id=38376

The element order tends to be pretty important in most XML
formats.

If applied to e.g. a simple XHTML file, your patch would place
all text nodes first in the body, followed by all headers, and
finally all paragraphs. I'm not sure a human reader would
agree that the resulting document looks better...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1356571&group_id=5470


More information about the Patches mailing list