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 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: 24.11 (2024-11-03)

Fixes

  • Avoid conflict with attributes named value when flattening extensions (#1085)

Features

  • Add cli config to use generic collections (#1082)

Deprecations

  • Drop support for python 3.8

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-24.11.tar.gz (340.2 kB view details)

Uploaded Source

Built Distribution

xsdata-24.11-py3-none-any.whl (229.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xsdata-24.11.tar.gz
  • Upload date:
  • Size: 340.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for xsdata-24.11.tar.gz
Algorithm Hash digest
SHA256 011193f775877d832d736b68e8553de3fe35b8447974effce08fc6cc3305d206
MD5 fa0366ca04ca6e5b98520a008aa0f5d6
BLAKE2b-256 66682c87ceae0788b6468a637d3d63cd6fcc90ca6b6029e8d23b9313d3d9b741

See more details on using hashes here.

Provenance

The following attestation bundles were made for xsdata-24.11.tar.gz:

Publisher: publish.yml on tefra/xsdata

Attestations:

File details

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

File metadata

  • Download URL: xsdata-24.11-py3-none-any.whl
  • Upload date:
  • Size: 229.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for xsdata-24.11-py3-none-any.whl
Algorithm Hash digest
SHA256 bb0ba63daab93c190cfc7d8bb3c2392422cc2ad0b7214f3061cf4cde231cce97
MD5 2c0e85115291fb9587fdb4da3f8ceaba
BLAKE2b-256 a1955dfb080e293175ed7c490a765bcf382827596b24ce5375aa0e4d785e961a

See more details on using hashes here.

Provenance

The following attestation bundles were made for xsdata-24.11-py3-none-any.whl:

Publisher: publish.yml on tefra/xsdata

Attestations:

Supported by

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