Package lxml :: Package html :: Module html5parser :: Class HTMLParser |
[hide private]
[frames] | no frames]

# Class HTMLParser

source code

                         object --+
                                  |
    html5lib.html5parser.HTMLParser --+
                                      |
                                     HTMLParser

An html5lib HTML parser with lxml as tree.

Instance Methods | [hide private]
__init__(self, strict=False, **kwargs) Example: | source code
Inherited from `html5lib.html5parser.HTMLParser`: `adjustForeignAttributes`, `adjustMathMLAttributes`, `adjustSVGAttributes`, `isHTMLIntegrationPoint`, `isMathMLTextIntegrationPoint`, `mainLoop`, `normalizeToken`, `normalizedTokens`, `parse`, `parseError`, `parseFragment`, `parseRCDataRawtext`, `reparseTokenNormal`, `reset`, `resetInsertionMode` Inherited from `html5lib.html5parser.HTMLParser` (private): `_parse` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `html5lib.html5parser.HTMLParser`: `documentEncoding` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, strict=False, **kwargs) (Constructor) | source code
Example:
    >>> from html5lib.html5parser import HTMLParser
    >>> parser = HTMLParser()                     # generates parser with etree builder
    >>> parser = HTMLParser('lxml', strict=True)  # generates parser with lxml builder which is strict
Parameters: `tree` - a treebuilder class controlling the type of tree that will be returned. Built in treebuilders can be accessed through html5lib.treebuilders.getTreeBuilder(treeType) `strict` - raise an exception when a parse error is encountered `namespaceHTMLElements` - whether or not to namespace HTML elements `debug` - whether or not to enable debug mode which logs things Overrides: object.__init__ (inherited documentation)