(text, parser=None)
return tree, ids
Parse XML document from string constant for its IDs.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an (Element, dict) tuple, in which the
    dict maps element id:s to elements.
Parse XML document from string constant for its IDs.
Parse XML document from string constant for its IDs .
def XMLID(text, parser=None):
    """Parse XML document from string constant for its IDs.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an (Element, dict) tuple, in which the
    dict maps element id:s to elements.

    """
    if not parser:
        parser = XMLParser(target=TreeBuilder())
    parser.feed(text)
    tree = parser.close()
    ids = {}
    for elem in tree.iter():
        id = elem.get("id")
        if id:
            ids[id] = elem
    return tree, ids
def XMLID ( text , parser = None ) : if not parser : parser = XMLParser ( target = TreeBuilder ( ) ) parser . feed ( text ) tree = parser . close ( ) ids = { } for elem in tree . iter ( ) : id = elem . get ( "id" ) if id : ids [ id ] = elem return tree , ids