From 6e4b4dfffbd6e8d465aebd009108654003da338b Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Wed, 22 Feb 2012 08:28:03 -0500 Subject: Added comments. --- bs4/builder/_lxml.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bs4/builder/_lxml.py') 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 -- cgit v1.2.3