Skip to main content

Python XML Binding

Project description

image

Naive XML Bindings for python

image image image image image image


xsData is a complete data binding library for python allowing developers to access and use XML and JSON documents as simple objects rather than using DOM.

The code generator supports XML schemas, DTD, WSDL definitions, XML & JSON documents. It produces simple dataclasses with type hints and simple binding metadata.

The included XML and JSON parser/serializer are highly optimized and adaptable, with multiple handlers and configuration properties.

xsData is constantly tested against the W3C XML Schema 1.1 test suite.

Getting started

$ # Install all dependencies
$ pip install xsdata[cli,lxml,soap]
$ # Generate models
$ xsdata generate tests/fixtures/primer/order.xsd --package tests.fixtures.primer
>>> from tests.fixtures.primer import PurchaseOrder
>>> from xsdata.formats.dataclass.parsers import XmlParser
>>>
>>> parser = XmlParser()
>>> order = parser.parse("tests/fixtures/primer/sample.xml", PurchaseOrder)
>>> order.bill_to
Usaddress(name='Robert Smith', street='8 Oak Avenue', city='Old Town', state='PA', zip=Decimal('95819'), country='US')

Check the documentation for more ✨✨✨

Features

Code Generator

  • XML Schemas 1.0 & 1.1
  • WSDL 1.1 definitions with SOAP 1.1 bindings
  • DTD external definitions
  • Directly from XML and JSON Documents
  • Extensive configuration to customize output
  • Pluggable code writer for custom output formats

Default Output

  • Pure python dataclasses with metadata
  • Type hints with support for forward references and unions
  • Enumerations and inner classes
  • Support namespace qualified elements and attributes

Data Binding

  • XML and JSON parser, serializer
  • PyCode serializer
  • Handlers and Writers based on lxml and native xml python
  • Support wildcard elements and attributes
  • Support xinclude statements and unknown properties
  • Customize behaviour through config

Changelog: 25.4 (2025-04-13)

Features

  • Allow extensions to match module paths (#1132)

  • Improve duplicate class names detection and resolution (#1127)

Fixes

  • Resolve Code Quality Issue

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xsdata-25.4.tar.gz (345.1 kB view details)

Uploaded Source

Built Distribution

xsdata-25.4-py3-none-any.whl (234.5 kB view details)

Uploaded Python 3

File details

Details for the file xsdata-25.4.tar.gz.

File metadata

  • Download URL: xsdata-25.4.tar.gz
  • Upload date:
  • Size: 345.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xsdata-25.4.tar.gz
Algorithm Hash digest
SHA256 eb3427e5d9e436b5408a9f6fdae3a7bc0c8b4edfbd22eb878acb29eb3685ed62
MD5 9c0fd1925cdda25d92a6fefe7a19b0c7
BLAKE2b-256 22b06229c0ff37be887059a709f45e22165b30c2c34bca00c035c12cd76eef3b

See more details on using hashes here.

File details

Details for the file xsdata-25.4-py3-none-any.whl.

File metadata

  • Download URL: xsdata-25.4-py3-none-any.whl
  • Upload date:
  • Size: 234.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xsdata-25.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7a318961d3596dc25e08b1f02478bde5f63d3dcbc2b1e12382f1648371b91ccd
MD5 bd5803c0b4ea02a3f85a3ae9308280c7
BLAKE2b-256 11cb8e8f6bf0b08d650173a0d7b3282155588aa8f22d38850773a66208a0e868

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page