Skip to content

Instantly share code, notes, and snippets.

@dkdndes
Last active April 23, 2022 01:38
Show Gist options
  • Save dkdndes/f7dbe8f2affde3361398 to your computer and use it in GitHub Desktop.
Save dkdndes/f7dbe8f2affde3361398 to your computer and use it in GitHub Desktop.
lxml objectify xml with xsd schema
def objectify_parse_with_schema(schemaname, infilename):
schema = etree.XMLSchema(file=schemaname)
parser = objectify.makeparser(schema=schema)
doctree = objectify.parse(infilename, parser=parser)
root = doctree.getroot()
return doctree, root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment