def parseXRDS(text):
    """Parse the given text as an XRDS document.

    @return: ElementTree containing an XRDS document

    @raises XRDSError: When there is a parse error or the document does
        not contain an XRDS.
    """
    try:
        element = SafeElementTree.XML(text)
    except (SystemExit, MemoryError, AssertionError, __HOLE__):
        raise
    except Exception as why:
        exc = XRDSError('Error parsing document as XML')
        exc.reason = why
        raise exc
    else:
        tree = ElementTree.ElementTree(element)
        if not isXRDS(tree):
            raise XRDSError('Not an XRDS document')

        return tree
dataset/ETHPy150Open necaris/python3-openid/openid/yadis/etxrd.py/parseXRDS