https://github.com/tefra/xsdata/raw/master/docs/_static/logo.png

Naive XML Bindings for python

https://github.com/tefra/xsdata/workflows/tests/badge.svg https://readthedocs.org/projects/xsdata/badge https://codecov.io/gh/tefra/xsdata/branch/master/graph/badge.svg https://img.shields.io/github/languages/top/tefra/xsdata.svg https://www.codefactor.io/repository/github/tefra/xsdata/badge https://img.shields.io/pypi/pyversions/xsdata.svg https://img.shields.io/pypi/v/xsdata.svg

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 that don’t depend on the library itself 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.

https://github.com/tefra/xsdata/raw/master/docs/_static/demo.svg

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: 20.11.1 (2020-11-13)

  • Catch all type errors on xsi cache build #316

Changelog: 20.11 (2020-11-10)

  • Added sub command to download remote schemas and definitions. #279

  • Added new optional xml type Elements to maintain ordering for repeatable choices. #296

  • Added xsi:type lookup procedure for xs:anyType derived elements. #306

  • Updated simple type flattening detection. #286

  • Updated generator to allow namespace structure on schemas without target namespace.

  • Updated generator to avoid writing min/max occurs metadata for implied values. #297

  • Update generator to use literal dictionary initialization.

  • Updated parser security, disable lxml network and entities resolve.

  • Fixed field types detection for elements with xs:alternative children. #284

  • Fixed file generation to enforce default charset UTF-8. #302

  • Fixed jinja2 undefined namespace var collision. #298

  • Fixed import class name collision. #300

  • Fixed restriction inheritance on xs:group elements. #301

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!