Skip to content

Instantly share code, notes, and snippets.

@bor8
Created September 29, 2016 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bor8/677c3fd390f004ea7a46bb48bf7a4fa2 to your computer and use it in GitHub Desktop.
Save bor8/677c3fd390f004ea7a46bb48bf7a4fa2 to your computer and use it in GitHub Desktop.
Test own schema.
schema_root = etree.XML('''\
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="a" type="xsd:integer"/>
</xsd:schema>
''')
schema = etree.XMLSchema(schema_root)
parser = etree.XMLParser(schema = schema)
root = etree.fromstring("<a>5</a>", parser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment