[issue4147] xml.dom.minidom toprettyxml: omit whitespace for text-only elements

Ezio Melotti report at bugs.python.org
Tue Nov 15 11:21:33 CET 2011


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

Here is a new patch based on Dan's last patch.
Correct me if I'm wrong, but it seems to me that it's not possible for a node to have only text-nodes as children and yet have more than one child; i.e. you can't have two or more adjacent text nodes, because they would be considered as a single text node.  I therefore changed the check with all() to check if there's only a child and if it's a text node.
I also added a test that checks where the \n and \t are added, because testing only that the DOM is preserved is not enough.

----------
stage: test needed -> commit review
Added file: http://bugs.python.org/file23692/issue4147.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4147>
_______________________________________


More information about the Python-bugs-list mailing list