def parseFileAndReport(filename, _open=file):
 content = _TagTrackingContentHandler()
 error = _LocationReportingErrorHandler(content)
 parser = make_parser()
 parser.setContentHandler(content)
 parser.setErrorHandler(error)
 parser.reset()
 parser.reset = (lambda : None)
 parser._parser.UseForeignDTD(True)
 parser.setEntityResolver(_LocalEntityResolver(filename))
 parser.setFeature(feature_validation, False)
 fObj = _open(filename)
 try:
  parser.parse(fObj)
 except IOError as e:
  raise process.ProcessingFailure((((e.strerror + ", filename was '") + filename) + "'"))
 finally:
  fObj.close()
 return content.document

def parseFileAndReport ( filename , _open = file ) : content = _TagTrackingContentHandler ( ) error = _LocationReportingErrorHandler ( content ) parser = make_parser ( ) parser . setContentHandler ( content ) parser . setErrorHandler ( error ) parser . reset ( ) parser . reset = ( lambda : None ) parser . _parser . UseForeignDTD ( True ) parser . setEntityResolver ( _LocalEntityResolver ( filename ) ) parser . setFeature ( feature_validation , False ) fObj = _open ( filename ) try : parser . parse ( fObj ) except IOError as e : raise process . ProcessingFailure ( ( ( ( e . strerror + ", filename was '" ) + filename ) + "'" ) ) finally : fObj . close ( ) return content . document
parse and return the contents of the given lore xhtml document .