Is there any library for python to deal with XML-Schema Definitions (xsd)? I found 'pyxb' and it looks very promising, but development ended in 2018.
2 Answers
The fact that development of a product has ended does not necessarily mean it is dead: it might just be complete and stable.
There is another candidate: Saxon/C. The Enterprise Edition supports XSD processing, and offers a Python API. A disclaimer, however: it is a commercial product produced by my company, Saxonica.
There is XMLSchema which looks very promising, is MIT licensed, currently maintained as at April 2021 and claims:
- Full XSD 1.0 and XSD 1.1 support
- Building of XML schema objects from XSD files
- Validation of XML instances against XSD schemas
- Decoding of XML data into Python data and to JSON
- Encoding of Python data and JSON to XML
- Data decoding and encoding ruled by converter classes
- An XPath based API for finding schema's elements and attributes
- Support of XSD validation modes strict/lax/skip
- Remote attacks protection by default using an XMLParser that forbids entities
- XML data bindings based on DataElement class
- Static code generation with Jinja2 templates