summaryrefslogtreecommitdiff
path: root/beautifulsoup/builder/lxml_builder.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-20 09:54:42 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-20 09:54:42 -0500
commitae349fd47c627f8166526fed8906811707d2f4b2 (patch)
tree116edd8c1d9a7cf6348f784162fd2291608833c2 /beautifulsoup/builder/lxml_builder.py
parent158e76fd3e1005f6f5f932414cb741083d114cb6 (diff)
parent9f437ea591aeaf16d593350baf081315e56a8b73 (diff)
Greatly improved the handling of empty-element tags.
Diffstat (limited to 'beautifulsoup/builder/lxml_builder.py')
-rw-r--r--beautifulsoup/builder/lxml_builder.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/beautifulsoup/builder/lxml_builder.py b/beautifulsoup/builder/lxml_builder.py
index 72e5913..e431a62 100644
--- a/beautifulsoup/builder/lxml_builder.py
+++ b/beautifulsoup/builder/lxml_builder.py
@@ -7,16 +7,15 @@ import types
class LXMLTreeBuilderForXML(TreeBuilder):
DEFAULT_PARSER_CLASS = etree.XMLParser
- preserve_whitespace_tags = set()
- self_closing_tags = set()
-
@property
def default_parser(self):
# This can either return a parser object or a class, which
# will be instantiated with default arguments.
return etree.XMLParser
- def __init__(self, parser=None):
+ def __init__(self, parser=None, empty_element_tags=None):
+ if empty_element_tags is not None:
+ self.empty_element_tags = set(empty_element_tags)
if parser is None:
# Use the default parser.
parser = self.default_parser
@@ -53,9 +52,6 @@ class LXMLTreeBuilderForXML(TreeBuilder):
def end(self, name):
self.soup.endData()
completed_tag = self.soup.tagStack[-1]
- if len(completed_tag.contents) == 0:
- completed_tag.isSelfClosing = True
-
self.soup.handle_endtag(name)
def pi(self, target, data):