relaxng = etree.RelaxNG(relaxng_doc)
valid = StringIO('<a><b></b></a>')
doc = etree.parse(valid)
relaxng.validate(doc)
invalid = StringIO('<a><c></c></a>')
doc2 = etree.parse(invalid)
relaxng.validate(doc2)
How do I validate XML document using RELAX NG schema in Python?