(file, context, namespaces=True)
return result
Parse a fragment of a document, given the context from which it
    was originally extracted.  context should be the parent of the
    node(s) which are in the fragment.

    'file' may be either a file name or an open file object.
Parse a fragment of a document, given the context from which it
    was originally extracted.  context should be the parent of the
    node(s) which are in the fragment.
Parse a fragment of a document given the context from which it was originally extracted . context should be the parent of the node ( s ) which are in the fragment .
def parseFragment(file, context, namespaces=True):
    """Parse a fragment of a document, given the context from which it
    was originally extracted.  context should be the parent of the
    node(s) which are in the fragment.

    'file' may be either a file name or an open file object.
    """
    if namespaces:
        builder = FragmentBuilderNS(context)
    else:
        builder = FragmentBuilder(context)

    if isinstance(file, str):
        with open(file, 'rb') as fp:
            result = builder.parseFile(fp)
    else:
        result = builder.parseFile(file)
    return result
def parseFragment ( file , context , namespaces = True ) : if namespaces : builder = FragmentBuilderNS ( context ) else : builder = FragmentBuilder ( context ) if isinstance ( file , str ) : with open ( file , 'rb' ) as fp : result = builder . parseFile ( fp ) else : result = builder . parseFile ( file ) return result