def xmlvalid(xml, xsd):
xsd1 = etree.parse(xsd)<EOL>xsd2 = etree.XMLSchema(xsd1)<EOL>doc = etree.parse(StringIO(xml))<EOL>return xsd2.validate(doc)<EOL>
Test whether an XML document is valid

Parameters
----------

- xml: XML content
- xsd: pointer to XML Schema (local file path or URL)