summaryrefslogtreecommitdiffstats
path: root/Lib/xml/dom
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2000-12-28 18:40:56 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2000-12-28 18:40:56 (GMT)
commit156c337f665a713767fa63b6c16ee6e9dea16250 (patch)
tree4d481c4ef5ad6068fdc4f605725d621e7ccf583f /Lib/xml/dom
parent88b5ae0110c614591c31a1f0f63c81655f49651f (diff)
downloadcpython-156c337f665a713767fa63b6c16ee6e9dea16250.zip
cpython-156c337f665a713767fa63b6c16ee6e9dea16250.tar.gz
cpython-156c337f665a713767fa63b6c16ee6e9dea16250.tar.bz2
Merge changes up to 1.10 from PyXML:
- implement hasAttribute and hasAttributeNS (1.7) - Node.replaceChild(): Update the sibling nodes to point to newChild. Set the .nextSibling attribute on oldChild instead of adding a .newChild attribute (1.9).
Diffstat (limited to 'Lib/xml/dom')
-rw-r--r--Lib/xml/dom/minidom.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index d078f39..98a75b9 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -145,8 +145,12 @@ class Node(_Node):
oldChild.parentNode = None
newChild.nextSibling = oldChild.nextSibling
newChild.previousSibling = oldChild.previousSibling
- oldChild.newChild = None
+ oldChild.nextSibling = None
oldChild.previousSibling = None
+ if newChild.previousSibling:
+ newChild.previousSibling.nextSibling = newChild
+ if newChild.nextSibling:
+ newChild.nextSibling.previousSibling = newChild
return oldChild
def removeChild(self, oldChild):
@@ -463,6 +467,12 @@ class Element(Node):
del self._attrs[node.name]
del self._attrsNS[(node.namespaceURI, node.localName)]
+ def hasAttribute(self, name):
+ return self._attrs.has_key(name)
+
+ def hasAttributeNS(self, namespaceURI, localName):
+ return self._attrsNS.has_key((namespaceURI, localName))
+
def getElementsByTagName(self, name):
return _getElementsByTagNameHelper(self, name, [])