def parseXRDS(text):
 try:
  element = ElementTree.XML(text)
 except XMLError 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

def parseXRDS ( text ) : try : element = ElementTree . XML ( text ) except XMLError 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
parse the given text as an xrds document .