summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-10-01 20:49:25 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-10-01 20:49:25 (GMT)
commitc8faf9bb0cdd5faa957fbd3aa38b637c68cdee34 (patch)
treecbf020223e488d654547b93dcf0328023341ed2a /Lib/xml
parentf06eb46918f11220d13e7170dcb17929498e3294 (diff)
downloadcpython-c8faf9bb0cdd5faa957fbd3aa38b637c68cdee34.zip
cpython-c8faf9bb0cdd5faa957fbd3aa38b637c68cdee34.tar.gz
cpython-c8faf9bb0cdd5faa957fbd3aa38b637c68cdee34.tar.bz2
#4147: minidom's toprettyxml no longer adds whitespace to text nodes.
Patch by Dan Kenigsberg.
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/dom/minidom.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 7518852..a1f6f63 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -806,7 +806,9 @@ class Element(Node):
_write_data(writer, attrs[a_name].value)
writer.write("\"")
if self.childNodes:
- writer.write(">%s"%(newl))
+ writer.write(">")
+ if self.childNodes[0].nodeType != Node.TEXT_NODE:
+ writer.write(newl)
for node in self.childNodes:
node.writexml(writer,indent+addindent,addindent,newl)
writer.write("%s</%s>%s" % (indent,self.tagName,newl))
@@ -1031,7 +1033,7 @@ class Text(CharacterData):
return newText
def writexml(self, writer, indent="", addindent="", newl=""):
- _write_data(writer, "%s%s%s"%(indent, self.data, newl))
+ _write_data(writer, self.data)
# DOM Level 3 (WD 9 April 2002)