From: Fred Drake Date: Fri, 23 Mar 2001 04:39:24 +0000 (+0000) Subject: When creating an attribute node using createAttribute() or X-Git-Tag: v2.1b2~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6526bf863eff2ef78465ba90d19a280d6657bddf;p=thirdparty%2FPython%2Fcpython.git When creating an attribute node using createAttribute() or createAttributeNS(), use the parallel setAttributeNode() or setAttributeNodeNS() to add the node to the document -- do not assume that setAttributeNode() will operate properly for both. --- diff --git a/Lib/xml/dom/pulldom.py b/Lib/xml/dom/pulldom.py index d7280ee89a6f..d71f6dfcb304 100644 --- a/Lib/xml/dom/pulldom.py +++ b/Lib/xml/dom/pulldom.py @@ -83,10 +83,11 @@ class PullDOM(xml.sax.ContentHandler): else: qname = a_localname attr = self.document.createAttributeNS(a_uri, qname) + node.setAttributeNodeNS(attr) else: attr = self.document.createAttribute(a_localname) + node.setAttributeNode(attr) attr.value = value - node.setAttributeNode(attr) self.lastEvent[1] = [(START_ELEMENT, node), None] self.lastEvent = self.lastEvent[1]