Skip to main content

docx4j-xsdata

This is the docx4j-python fork of xsdata (MIT). It is the same library, published as the distribution docx4j-xsdata with the import package docx4j_xsdata and the console script docx4j-xsdata, so that it can be installed alongside upstream xsdata in one environment. Code generated by this fork imports its runtime types from docx4j_xsdata.

Upstream's MIT licence and copyright (Christodoulos Tsoulloftas) are unchanged and are kept in LICENSE; the MIT text requires no additional notice for the fork's changes. Modifications in this fork are copyright (c) 2026 Plutext Pty Ltd and are released under the same MIT licence.

The rest of this README is upstream's.


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 docx4j-xsdata[cli,lxml,soap]
$ # Generate models
$ docx4j-xsdata generate tests/fixtures/primer/order.xsd --package tests.fixtures.primer
>>> from tests.fixtures.primer import PurchaseOrder
>>> from docx4j_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: 26.2 (2026-02-15)

Fixes

  • Fix elements in same choice different branches incorrectly merged as list (#1206)

Features

  • Infer XML required property from typing annotations (#1208)
  • Generate required metadata only for attributes without default values (#1208)

Release files for docx4j-xsdata 26.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docx4j-xsdata 26.2.1
File Size Uploaded
docx4j_xsdata-26.2.1.tar.gz 448.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docx4j-xsdata 26.2.1
File Interpreter ABI Platform
docx4j_xsdata-26.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 708.6 kB

Release files / docx4j_xsdata-26.2.1.tar.gz

Download URL docx4j_xsdata-26.2.1.tar.gz
Size 448.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ed6d94725ec059e633d1ddec8e943071d0e5a49d40d32c9fc5854a8da6b1529d
BLAKE2b-256 checksum
How to use checksums
805581266d180ec9195fc866a47f25c9e41a0541dd7c1a829604bd11a8de3e5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / docx4j_xsdata-26.2.1-py3-none-any.whl

Download URL docx4j_xsdata-26.2.1-py3-none-any.whl
Size 259.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dd026ac8b7df1d1590d17cde5bc3cc638461994da44d231cb5a82652f768f8b
BLAKE2b-256 checksum
How to use checksums
f80f209eb6c5f6cf94fc59b9e19756bc1578525dc7439e95239c811760d2f6be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

26.2.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page