import libxml2

options = libxml2.HTML_PARSE_RECOVER + \
                      libxml2.HTML_PARSE_NOERROR + \
                      libxml2.HTML_PARSE_NOWARNING

class Parser(object):
    def __init__(self, doc, url='', options=options):
        self.doc = libxml2.htmlReadDoc(doc, url, 'utf-8', options)

    def __del__(self):
        self.doc.freeDoc()