Naive XML Bindings for python¶
xsData is a complete XML data binding library for python allowing developers to access and use XML documents as simple objects rather than using DOM.
It ships with a code generator for XML Schema definitions and WSDL 1.1 with SOAP 1.1 bindings. It produces simple dataclasses with type hints in order to reduce the learning curve for users that have to write the binding models manually.
The included xml parser and serializer are highly optimized and adaptable with handlers based on native python and lxml. The parser configuration offers the ability to skip unknown properties and to process xinclude statements.
xsData is constantly tested against the W3C XML Schema 1.1 test suite.
Check the documentation demos or our W3C XML Schema 1.1 test runner and the samples repo for more ✨✨✨
Features¶
Generate data models for XML Schema 1.0 and 1.1 definitions.
Generate data models for WSDL 1.1 and SOAP 1.1 bindings.
Support qualified elements/attributes, enumerations and inner classes.
Preserve embedded documentation and references.
Data binding for XML and JSON documents.
Pluggable code writer that supports python dataclasses and PlantUML class diagrams.
Changelog: 21.1 (2021-01-08)¶
Fixed XmlWriter converting attribute keys to QName. #346
Set empty complexType base to anySimpleType #349
Improve duplicate attr names detection #351
Add SerializerConfig::xml_declaration option #357
Generate default value/factory for compound fields #359
Fixed default value for token fields #360
Add doc metadata for compound fields #362
JsonParser: handle class and primitive unions #369
- Update python mappings #366
Map xs:hexBinary and xs:base64Binary to bytes
Map xs:date/time types to builtin types XmlDate/Time
Map xs:duration to builtin type XmlDuration
Map xs:g[Year[Month[Day]]] to builtin type XmlPeriod
Map xs:Notation to QName
Add converter adapters for datetime.date/time
Add fields metadata key ‘format’ for time/date/binary types
Fixed issues with default literal values
Fixed issue with random field types order
Why naive?
The W3C XML Schema offers so much flexibility and abstraction layers and grammatical rules to support practically any xml document definition.
Integration teams and clients don’t care about any of that, take out abstraction and flexibility and you are left with lean named data structures with typed attributes and a namespace for humans to read!