diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-06-03 14:06:42 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-06-03 14:06:42 (GMT) |
commit | ed525fb0dfa45595e8e93cbde3d5b05838bf993a (patch) | |
tree | 4444146f6effb9300bd403bbb70e26c76a32d084 | |
parent | 453163d842568dd066cfb5f047f3948d177743d7 (diff) | |
download | cpython-ed525fb0dfa45595e8e93cbde3d5b05838bf993a.zip cpython-ed525fb0dfa45595e8e93cbde3d5b05838bf993a.tar.gz cpython-ed525fb0dfa45595e8e93cbde3d5b05838bf993a.tar.bz2 |
Fix getElementsByTagNameNS:
- actually return a result
- Compare with tag.localName in getElementsByTagNameNSHelper
-rw-r--r-- | Lib/xml/dom/minidom.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py index 97d622f..59f86a7 100644 --- a/Lib/xml/dom/minidom.py +++ b/Lib/xml/dom/minidom.py @@ -279,7 +279,7 @@ def _getElementsByTagNameHelper(parent, name, rc): def _getElementsByTagNameNSHelper(parent, nsURI, localName, rc): for node in parent.childNodes: if node.nodeType == Node.ELEMENT_NODE: - if ((localName == "*" or node.tagName == localName) and + if ((localName == "*" or node.localName == localName) and (nsURI == "*" or node.namespaceURI == nsURI)): rc.append(node) _getElementsByTagNameNSHelper(node, nsURI, localName, rc) @@ -551,7 +551,9 @@ class Element(Node): return _getElementsByTagNameHelper(self, name, []) def getElementsByTagNameNS(self, namespaceURI, localName): - _getElementsByTagNameNSHelper(self, namespaceURI, localName, []) + rc = [] + _getElementsByTagNameNSHelper(self, namespaceURI, localName, rc) + return rc def __repr__(self): return "<DOM Element: %s at %s>" % (self.tagName, id(self)) @@ -880,7 +882,9 @@ class Document(Node): return a def getElementsByTagNameNS(self, namespaceURI, localName): - _getElementsByTagNameNSHelper(self, namespaceURI, localName) + rc = [] + _getElementsByTagNameNSHelper(self, namespaceURI, localName, rc) + return rc def getElementsByTagName(self, name): rc = [] |