(file, namespaces=True)
return result
Parse a document, returning the resulting Document node.

    'file' may be either a file name or an open file object.
Parse a document, returning the resulting Document node.
Parse a document returning the resulting Document node .
def parse(file, namespaces=True):
    """Parse a document, returning the resulting Document node.

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

    if isinstance(file, str):
        with open(file, 'rb') as fp:
            result = builder.parseFile(fp)
    else:
        result = builder.parseFile(file)
    return result
def parse ( file , namespaces = True ) : if namespaces : builder = ExpatBuilderNS ( ) else : builder = ExpatBuilder ( ) if isinstance ( file , str ) : with open ( file , 'rb' ) as fp : result = builder . parseFile ( fp ) else : result = builder . parseFile ( file ) return result