Package lxml :: Package html :: Class XHTMLParser

[hide private]
[frames] | no frames]

# Class XHTMLParser

source code

           object --+
                    |
    etree._BaseParser --+
                        |
        etree._FeedParser --+
                            |
              etree.XMLParser --+
                                |
                               XHTMLParser

An XML parser that is configured to return lxml.html Element objects.

Note that this parser is not really XHTML aware unless you let it load a DTD that declares the HTML entities. To do this, make sure you have the XHTML DTDs installed in your catalogs, and create the parser like this:

    >>> parser = XHTMLParser(load_dtd=True)

If you additionally want to validate the document, use this:

    >>> parser = XHTMLParser(dtd_validation=True)

For catalog support, see http://www.xmlsoft.org/catalog.html.

Instance Methods | [hide private]

__init__(self, **kwargs) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

Inherited from `etree.XMLParser`: `__new__` Inherited from `etree._FeedParser`: `close`, `feed` Inherited from `etree._BaseParser`: `copy`, `makeelement`, `setElementClassLookup`, `set_element_class_lookup` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]

Inherited from `etree._FeedParser`: `feed_error_log` Inherited from `etree._BaseParser`: `error_log`, `resolvers`, `target`, `version` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, **kwargs)
(Constructor)

source code

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
  (inherited documentation)