(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs)
return p.parseFragment(doc, container=container, **kwargs)
Parse an HTML fragment as a string or file-like object into a tree

    :arg doc: the fragment to parse as a string or file-like object

    :arg container: the container context to parse the fragment in

    :arg treebuilder: the treebuilder to use when parsing

    :arg namespaceHTMLElements: whether or not to namespace HTML elements

    :returns: parsed tree

    Example:

    >>> from html5lib.html5libparser import parseFragment
    >>> parseFragment('<b>this is a fragment</b>')
    <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>
Parse an HTML fragment as a string or file-like object into a tree
Parse an HTML fragment as a string or file - like object into a tree
def parseFragment(doc, container="div", treebuilder="etree", namespaceHTMLElements=True, **kwargs):
    """Parse an HTML fragment as a string or file-like object into a tree

    :arg doc: the fragment to parse as a string or file-like object

    :arg container: the container context to parse the fragment in

    :arg treebuilder: the treebuilder to use when parsing

    :arg namespaceHTMLElements: whether or not to namespace HTML elements

    :returns: parsed tree

    Example:

    >>> from html5lib.html5libparser import parseFragment
    >>> parseFragment('<b>this is a fragment</b>')
    <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>

    """
    tb = treebuilders.getTreeBuilder(treebuilder)
    p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements)
    return p.parseFragment(doc, container=container, **kwargs)
def parseFragment ( doc , container = "div" , treebuilder = "etree" , namespaceHTMLElements = True , * * kwargs ) : tb = treebuilders . getTreeBuilder ( treebuilder ) p = HTMLParser ( tb , namespaceHTMLElements = namespaceHTMLElements ) return p . parseFragment ( doc , container = container , * * kwargs )