diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 18:28:15 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 18:28:15 -0500 |
commit | 2f0b16b8ea82b09034dff0e747e29d89e97b5680 (patch) | |
tree | f35913725a819cdd0068180357468dee5bb89240 /beautifulsoup/builder/_lxml.py | |
parent | 1fa18e957db92cfa056151f4e0d93c44243df1d9 (diff) |
Tree builders now advertise their features.
Diffstat (limited to 'beautifulsoup/builder/_lxml.py')
-rw-r--r-- | beautifulsoup/builder/_lxml.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/beautifulsoup/builder/_lxml.py b/beautifulsoup/builder/_lxml.py index c2f368c..f5cc242 100644 --- a/beautifulsoup/builder/_lxml.py +++ b/beautifulsoup/builder/_lxml.py @@ -5,13 +5,20 @@ __all__ = [ from lxml import etree from beautifulsoup.element import Comment, Doctype -from beautifulsoup.builder import TreeBuilder, HTMLTreeBuilder +from beautifulsoup.builder import ( + FAST, + HTML, + HTMLTreeBuilder, + TreeBuilder, + XML) from beautifulsoup.dammit import UnicodeDammit import types class LXMLTreeBuilderForXML(TreeBuilder): DEFAULT_PARSER_CLASS = etree.XMLParser + features = [FAST, XML] + @property def default_parser(self): # This can either return a parser object or a class, which @@ -79,6 +86,8 @@ class LXMLTreeBuilderForXML(TreeBuilder): class LXMLTreeBuilder(HTMLTreeBuilder, LXMLTreeBuilderForXML): + features = [FAST, HTML] + @property def default_parser(self): return etree.HTMLParser |