diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 10:21:30 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 10:21:30 -0500 |
commit | 0339d1f4a0f7306cb8c1ef4d7cd609b06e33eb27 (patch) | |
tree | 40b1d7453a284da936c40e5e53402942c9650b74 /bs4/builder/_lxml.py | |
parent | 6e4b4dfffbd6e8d465aebd009108654003da338b (diff) | |
parent | a4ffd587fad7d2442a9ccdcdd0a8f6df347f39eb (diff) |
Merge from trunk and added tests.
Diffstat (limited to 'bs4/builder/_lxml.py')
-rw-r--r-- | bs4/builder/_lxml.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py index 77660a4..870d59e 100644 --- a/bs4/builder/_lxml.py +++ b/bs4/builder/_lxml.py @@ -72,7 +72,7 @@ class LXMLTreeBuilderForXML(TreeBuilder): self.parser.close() def close(self): - self.namespaces.clear() + self.nsmaps = None def start(self, name, attrs, nsmap={}): nsprefix = None @@ -108,6 +108,8 @@ class LXMLTreeBuilderForXML(TreeBuilder): completed_tag = self.soup.tagStack[-1] self.soup.handle_endtag(name) if self.nsmaps != None: + # This tag, or one of its parents, introduced a namespace + # mapping, so pop it off the stack. self.nsmaps.pop() if len(self.nsmaps) == 0: # Namespaces are no longer in play, so don't bother keeping |