GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing lxml.de — html5lib Parser Menu
html5lib Parserhtml5lib is a Python package that implements the HTML5 parsing algorithm which is heavily influenced by current browsers and based on the WHATWG HTML5 specification. lxml can benefit from the parsing capabilities of html5lib through the lxml.html.html5parser module. It provides a similar interface to the lxml.html module by providing fromstring(), parse(), document_fromstring(), fragment_fromstring() and fragments_fromstring() that work like the regular html parsing functions. Differences to regular HTML parsingThere are a few differences in the returned tree to the regular HTML parsing functions from lxml.html. html5lib normalizes some elements and element structures to a common format. For example, even if a table does not have a tbody html5lib will inject one automatically: >>> from lxml.html import tostring, html5parser >>> tostring(html5parser.fromstring("<table><td>foo")) '<table><tbody><tr><td>foo</td></tr></tbody></table>' Also the parameters the functions accept are different. Function Reference
Additionally all parsing functions accept a parser keyword argument that can be set to a custom parser instance. To create custom parsers you can subclass the HTMLParser and XHTMLParser from the same module. Note that these are the parser classes provided by html5lib. Generated on: 2026-06-16. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |