summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-03-31 16:30:40 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-03-31 16:30:40 (GMT)
commitcb67ea1d6e2dfb2680bba29144ef33fd2cc9a21a (patch)
tree52493ee30569e63430e650d2b20d0a22616919d2 /Lib/xml
parent68ad64af8744bf50a05eeebdca2fb735e86942f1 (diff)
downloadcpython-cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21a.zip
cpython-cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21a.tar.gz
cpython-cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21a.tar.bz2
Initialize Attr.value with empty string in createAttribute*, as per DOM
spec. Closes bug #412036. Also reindent toprettyxml.
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/dom/minidom.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 72ec5e0..81315e7 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -87,11 +87,11 @@ class Node(_Node):
return writer.getvalue()
def toprettyxml(self, indent="\t", newl="\n"):
- # indent = the indentation string to prepend, per level
- # newl = the newline string to append
- writer = _get_StringIO()
- self.writexml(writer, "", indent, newl)
- return writer.getvalue()
+ # indent = the indentation string to prepend, per level
+ # newl = the newline string to append
+ writer = _get_StringIO()
+ self.writexml(writer, "", indent, newl)
+ return writer.getvalue()
def hasChildNodes(self):
if self.childNodes:
@@ -794,6 +794,7 @@ class Document(Node):
def createAttribute(self, qName):
a = Attr(qName)
a.ownerDocument = self
+ a.value = ""
return a
def createElementNS(self, namespaceURI, qualifiedName):
@@ -806,6 +807,7 @@ class Document(Node):
prefix, localName = _nssplit(qualifiedName)
a = Attr(qualifiedName, namespaceURI, localName, prefix)
a.ownerDocument = self
+ a.value = ""
return a
def getElementsByTagNameNS(self, namespaceURI, localName):