Commit c35c53ff authored by Martin v. Löwis's avatar Martin v. Löwis

Initialize Attr.value with empty string in createAttribute*, as per DOM

spec. Closes bug #412036.
Also reindent toprettyxml.
parent 26a13613
...@@ -87,11 +87,11 @@ class Node(_Node): ...@@ -87,11 +87,11 @@ class Node(_Node):
return writer.getvalue() return writer.getvalue()
def toprettyxml(self, indent="\t", newl="\n"): def toprettyxml(self, indent="\t", newl="\n"):
# indent = the indentation string to prepend, per level # indent = the indentation string to prepend, per level
# newl = the newline string to append # newl = the newline string to append
writer = _get_StringIO() writer = _get_StringIO()
self.writexml(writer, "", indent, newl) self.writexml(writer, "", indent, newl)
return writer.getvalue() return writer.getvalue()
def hasChildNodes(self): def hasChildNodes(self):
if self.childNodes: if self.childNodes:
...@@ -794,6 +794,7 @@ class Document(Node): ...@@ -794,6 +794,7 @@ class Document(Node):
def createAttribute(self, qName): def createAttribute(self, qName):
a = Attr(qName) a = Attr(qName)
a.ownerDocument = self a.ownerDocument = self
a.value = ""
return a return a
def createElementNS(self, namespaceURI, qualifiedName): def createElementNS(self, namespaceURI, qualifiedName):
...@@ -806,6 +807,7 @@ class Document(Node): ...@@ -806,6 +807,7 @@ class Document(Node):
prefix, localName = _nssplit(qualifiedName) prefix, localName = _nssplit(qualifiedName)
a = Attr(qualifiedName, namespaceURI, localName, prefix) a = Attr(qualifiedName, namespaceURI, localName, prefix)
a.ownerDocument = self a.ownerDocument = self
a.value = ""
return a return a
def getElementsByTagNameNS(self, namespaceURI, localName): def getElementsByTagNameNS(self, namespaceURI, localName):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment