summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-10-01 20:22:35 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-10-01 20:22:35 (GMT)
commit1d30db459d0c0c084813693740295ad6fce2c175 (patch)
tree14c416b9a68998a8d244771e69c3e65564803903 /Lib/xml
parenta02a12c517e69e457f4425aa5af6f55c36a6a39a (diff)
parent791744b07004222c31b4fca34e62607685aa11fa (diff)
downloadcpython-1d30db459d0c0c084813693740295ad6fce2c175.zip
cpython-1d30db459d0c0c084813693740295ad6fce2c175.tar.gz
cpython-1d30db459d0c0c084813693740295ad6fce2c175.tar.bz2
merge #4147: minidom's toprettyxml no longer adds whitespace to text nodes.
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 218c62e..386494d 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -836,7 +836,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))
@@ -1061,7 +1063,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)