diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 12:23:12 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 12:23:12 -0500 |
commit | fcefebe15290b9ff44934efa73fb07c70ebf5171 (patch) | |
tree | c0b3ae8837a96975e1b88f3e2e9befc07a72e70c /bs4/builder/_lxml.py | |
parent | b7749c50a2c96ccf6982cfa1ca02d883e31e0af9 (diff) |
Fixed handling of the closing of namespaced tags.
Diffstat (limited to 'bs4/builder/_lxml.py')
-rw-r--r-- | bs4/builder/_lxml.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py index 870d59e..e5e30d4 100644 --- a/bs4/builder/_lxml.py +++ b/bs4/builder/_lxml.py @@ -106,7 +106,14 @@ class LXMLTreeBuilderForXML(TreeBuilder): def end(self, name): self.soup.endData() completed_tag = self.soup.tagStack[-1] - self.soup.handle_endtag(name) + namespace, name = self._getNsTag(name) + nsprefix = None + if namespace is not None: + for inverted_nsmap in reversed(self.nsmaps): + if inverted_nsmap is not None and namespace in inverted_nsmap: + nsprefix = inverted_nsmap[namespace] + break + self.soup.handle_endtag(name, nsprefix) if self.nsmaps != None: # This tag, or one of its parents, introduced a namespace # mapping, so pop it off the stack. |