Guest User

Untitled

a guest
Jun 18th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. from lxml import etree
  2.  
  3. schema = open("schema.xsd")
  4. library = open("library.xml")
  5.  
  6. xmlschema_doc = etree.parse(schema)
  7. xmlschema = etree.XMLSchema(xmlschema_doc)
  8. library_doc = etree.parse(library)
  9.  
  10. if xmlschema.validate(library_doc):
  11. print "Valid XML"
  12. else:
  13. print "Invalid XML"
Add Comment
Please, Sign In to add comment