fdutils/xml.py
def parse_xml(xml_str_or_file, parser=None, **parser_kwargs):
    """ simple lxml parser to execute the correct parsing method and use ETree class as the default
        so we can use xpathbuilder directly without str casting

    Args:
        xml_str_or_file (str or IOBase):
        parser:
        **parser_kwargs:

    Returns:

    """
    if not parser:
        parser_lookup = ET.ElementDefaultClassLookup(element=ElementBaseXpathStr)
        parser = ET.XMLParser(**parser_kwargs)
        parser.set_element_class_lookup(parser_lookup)

    if isinstance(xml_str_or_file, str):
        return ET.fromstring(xml_str_or_file, parser=parser)
    elif isinstance(xml_str_or_file, bytes):
        return ET.parse(io.BytesIO(xml_str_or_file), parser=parser).getroot()
    elif hasattr(xml_str_or_file, 'read'):
        return ET.parse(xml_str_or_file, parser=parser).getroot()
    else:
        raise NotImplementedError('We only know how to parse string, bytes or file objects.  Use straight lxml methods')
 simple lxml parser to execute the correct parsing method and use ETree class as the default
        so we can use xpathbuilder directly without str casting

    Args:
        xml_str_or_file (str or IOBase):
        parser:
        **parser_kwargs:

    Returns:

    
simple lxml parser to execute the correct parsing method and use ETree class as the default
so we can use xpathbuilder directly without str casting
simple lxml parser to execute the correct parsing method and use ETree class as the default so we can use xpathbuilder directly without str casting
def parse_xml(xml_str_or_file, parser=None, **parser_kwargs):
    if not parser:
        parser_lookup = ET.ElementDefaultClassLookup(element=ElementBaseXpathStr)
        parser = ET.XMLParser(**parser_kwargs)
        parser.set_element_class_lookup(parser_lookup)
    if isinstance(xml_str_or_file, str):
        return ET.fromstring(xml_str_or_file, parser=parser)
    elif isinstance(xml_str_or_file, bytes):
        return ET.parse(io.BytesIO(xml_str_or_file), parser=parser).getroot()
    elif hasattr(xml_str_or_file, 'read'):
        return ET.parse(xml_str_or_file, parser=parser).getroot()
    else:
        raise NotImplementedError('We only know how to parse string, bytes or file objects.  Use straight lxml methods')
def parse_xml ( xml_str_or_file , parser = None , ** parser_kwargs ) : if not parser : parser_lookup = ET . ElementDefaultClassLookup ( element = ElementBaseXpathStr ) parser = ET . XMLParser ( ** parser_kwargs ) parser . set_element_class_lookup ( parser_lookup ) if isinstance ( xml_str_or_file , str ) : return ET . fromstring ( xml_str_or_file , parser = parser ) elif isinstance ( xml_str_or_file , bytes ) : return ET . parse ( io . BytesIO ( xml_str_or_file ) , parser = parser ) . getroot ( ) elif hasattr ( xml_str_or_file , 'read' ) : return ET . parse ( xml_str_or_file , parser = parser ) . getroot ( ) else : raise NotImplementedError ( 'We only know how to parse string, bytes or file objects.  Use straight lxml methods' )
simple lxml parser to execute the correct parsing method and use ETree class as the default
so we can use xpathbuilder directly without str casting
simple lxml parser to execute the correct parsing method and use ETree class as the default so we can use xpathbuilder directly without str casting
""" simple lxml parser to execute the correct parsing method and use ETree class as the default
        so we can use xpathbuilder directly without str casting

    Args:
        xml_str_or_file (str or IOBase):
        parser:
        **parser_kwargs:

    Returns:

    """
None
xml_str_or_file
None
parser
None
**parser_kwargs
None