summaryrefslogtreecommitdiff
path: root/bs4/builder/_lxml.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-22 08:28:03 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-22 08:28:03 -0500
commit6e4b4dfffbd6e8d465aebd009108654003da338b (patch)
tree04832768d584c9317e91c4686e40cc1a76ceb7b0 /bs4/builder/_lxml.py
parentd0868034b9156862d562ec2544842f4598a9ab76 (diff)
Added comments.
Diffstat (limited to 'bs4/builder/_lxml.py')
-rw-r--r--bs4/builder/_lxml.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py
index 5175f36..77660a4 100644
--- a/bs4/builder/_lxml.py
+++ b/bs4/builder/_lxml.py
@@ -78,8 +78,9 @@ class LXMLTreeBuilderForXML(TreeBuilder):
nsprefix = None
# Invert each namespace map as it comes in.
if len(nsmap) == 0 and self.nsmaps != None:
- # There are namespaces in play, so we need to keep track
- # of when they start and end
+ # There are no new namespaces for this tag, but namespaces
+ # are in play, so we need a separate tag stack to know
+ # when they end.
self.nsmaps.append(None)
elif len(nsmap) > 0:
# A new namespace mapping has come into play.
@@ -109,9 +110,10 @@ class LXMLTreeBuilderForXML(TreeBuilder):
if self.nsmaps != None:
self.nsmaps.pop()
if len(self.nsmaps) == 0:
+ # Namespaces are no longer in play, so don't bother keeping
+ # track of the namespace stack.
self.nsmaps = None
-
def pi(self, target, data):
pass