Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6526bf8

Browse files
committed
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.
1 parent 5e0dfac commit 6526bf8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/xml/dom/pulldom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,11 @@ def startElementNS(self, name, tagName , attrs):
8383
else:
8484
qname = a_localname
8585
attr = self.document.createAttributeNS(a_uri, qname)
86+
node.setAttributeNodeNS(attr)
8687
else:
8788
attr = self.document.createAttribute(a_localname)
89+
node.setAttributeNode(attr)
8890
attr.value = value
89-
node.setAttributeNode(attr)
9091

9192
self.lastEvent[1] = [(START_ELEMENT, node), None]
9293
self.lastEvent = self.lastEvent[1]

0 commit comments

Comments
 (0)