FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

CaptainCodeman/html5lib-python at fecb2adf922f144c50b7c6eec332d28bf5eecf8a · GitHub

Latest commit

 

History

354 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html5lib is a pure-python library for parsing HTML. It is designed to
conform to the Web Applications 1.0 specification, which has
formalized the error handling algorithms of popular web browsers.

 = Installation =

html5lib is packaged with distutils. To install it use:
 $ python setup.py install

 = Tests =

You may wish to check that your installation has been a success by
running the testsuite. All the tests can be run by invoking
runtests.py in the tests/ directory

 = Usage =

Simple usage follows this pattern:

import html5lib

f = open("mydocument.html")

parser = html5lib.HTMLParser()
document = parser.parse(f)

By default, the returned document is a simple DOM-like structure which
can be navigated using the .parent and .childNode attributes on each
element. 

It is also possible to generate an ElementTree tree, this requires the use of the "tree" argument to the parser:

from html5lib.treebuilders import etree
parser = html5lib.HTMLParser(tree=etree.TreeBuilder)

Intrepid users may write their own treebuilder implementations - see
help(html5lib.treebuilders) for more information

More documentation is avaliable in the docstrings.

 = Bugs =

Please report any bugs on the issue tracker:
http://code.google.com/p/html5lib/issues/list

 = Get Involved =

Contributions to code or documenation are actively encouraged. Submit
patches to the issue tracker or discuss changes on irc in the #whatwg
channel on freenode.net

About

Standards-compliant library for parsing and serializing HTML documents and fragments in Python

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL