We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The elementtree.TidyTools Module

Tools to build element trees from HTML, using the external tidy utility.

Module Contents

getbody(file, **options) [#]

Get document body from a an HTML or HTML-like file. This function uses the tidy function to convert HTML to XHTML, and cleans up the resulting XML tree.

file
Filename.
Returns:
A body element, or None if not successful.

getzonebody(file, **options) [#]

Same as getbody, but turns plain text at the start of the document into an H1 tag. This function can be used to parse zone documents.

file
Filename.
Returns:
A body element, or None if not successful.

tidy(file, new_inline_tags=None) [#]

Convert an HTML or HTML-like file to XHTML, using the tidy command line utility.

file
Filename.
new_inline_tags
An optional list of valid but non-standard inline tags.
Returns:
An element tree, or None if not successful.