def call_xmllint(name, body): try: with open(CONFIG.xml_temp_file, 'w') as file: file.write(body) #if CONFIG.get('xml_xsd', None): args = [CONFIG.xml_temp_file] if CONFIG.get('xml_xsd', None): args += ["--schema", CONFIG.xml_xsd] processutils.execute(CONFIG.xmllint_bin, *args, check_exit_code=0, shell=False) except processutils.ProcessExecutionError as pe: fail("Error validating XML! %s" % pe)