get ''expected-doctype-but-got-chars " error when i use html5lib of python?
Question: This is my code:

    
    
    from html5lib import treebuilders, HTMLParser
    parser = HTMLParser(tree=treebuilders.getTreeBuilder("lxml"))
    parser.parse("hello world!")
    print parser.errors
    

what cause the error?

But the doc of html5lib use this:

    
    
    import html5lib
    parser = html5lib.HTMLParser(tree=html5lib.getTreeBuilder("dom"))
    minidom_document = parser.parse("<p>Hello World!")
    


Answer: `HTMLParser.errors` contains all parse errors from parsing the document;
html5lib should handle all parse errors gracefully by default (and yes, the
documentation does contain examples that generate parse errors — the aim is to
document the API, not show good HTML usage!), and hence unless you are for
some reason concerned about parse errors (unless you have a good reason to be,
don't be), its value is totally irrelevant.

