daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Feb 11th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def validate(self):
  2.  
  3.     # считывание файла схемы
  4.     with open(self.xsd_path, 'r') as schema_file:
  5.         schema_to_check = schema_file.read()
  6.     parser = etree.XMLParser(encoding='cp1251')
  7.     xmlschema_doc = etree.parse(StringIO(schema_to_check), parser)
  8.     xmlschema = etree.XMLSchema(xmlschema_doc)
  9.  
  10.     # здесь получаю результат валидации TRUE или FALSE
  11.     doc = etree.parse(self.xml_path, parser)
  12.     return xmlschema.validate(doc)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top