#NEWLINE# def validate_xml( xml , xsd ) : #NEWLINE# #INDENT# 'Validate XML document against XML Schema' #NEWLINE# LOGGER . info ( 'Validating %s against schema %s' , xml , err ) #NEWLINE# schema = etree . XMLSchema ( file = xsd ) #NEWLINE# parser = etree . XMLParser ( schema = schema , resolve_entities = False ) #NEWLINE# try : #NEWLINE# #INDENT# valid = etree . parse ( xml , parser ) #NEWLINE# return 'Valid' #NEWLINE# #UNINDENT# except Exception as err : #NEWLINE# #INDENT# raise RuntimeError ( ( 'ERROR: %s' % str ( err ) ) )