# HG changeset patch # User paulb # Date 1118948780 0 # Node ID a9497dde6a5a274fdd1a01b201e6f62055f01be0 # Parent ddddd136fcaad9b4f4f93022614cb6fbd4fc7143 [project @ 2005-06-16 19:06:20 by paulb] Added a tentative implementation of getElementsByTagNameNS, along with additional commentary. diff -r ddddd136fcaa -r a9497dde6a5a libxml2dom/__init__.py --- a/libxml2dom/__init__.py Sat May 28 13:55:46 2005 +0000 +++ b/libxml2dom/__init__.py Thu Jun 16 19:06:20 2005 +0000 @@ -260,6 +260,14 @@ else: Node_removeChild(self._node, tmp) + def getElementsByTagName(self, tagName): + return self.xpath("//" + tagName) + + def getElementsByTagNameNS(self, namespaceURI, localName): + return self.xpath("//ns:" + localName, namespaces={"ns" : namespaceURI}) + + # NOTE: normalize must be implemented specially for libxml2dom. + childNodes = property(_childNodes) value = data = nodeValue = property(_nodeValue, _setNodeValue) name = nodeName = property(_nodeName) @@ -279,9 +287,6 @@ #def __eq__(self, other): # return self._node.nodePath() == other._node.nodePath() - def getElementsByTagName(self, tagName): - return self.xpath("//" + tagName) - # 4DOM extensions to the usual PyXML API. # NOTE: To be finished.