When creating an attribute node using createAttribute() or
authorFred Drake <fdrake@acm.org>
Fri, 23 Mar 2001 04:39:24 +0000 (04:39 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 23 Mar 2001 04:39:24 +0000 (04:39 +0000)
createAttributeNS(), use the parallel setAttributeNode() or
setAttributeNodeNS() to add the node to the document -- do not assume
that setAttributeNode() will operate properly for both.

Lib/xml/dom/pulldom.py

index d7280ee89a6f2d9f14f6390d39552c4de873b2df..d71f6dfcb304c5c7e3e10c5e25fb01850a388a60 100644 (file)
@@ -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]