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)

Metadata

Release files for docx4j-xsdata 26.2.2

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.2
File Size Uploaded Provenance Actions
docx4j_xsdata-26.2.2.tar.gz 471.7 kB With provenance Details for docx4j_xsdata-26.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 736.1 kB

Release files / docx4j_xsdata-26.2.2.tar.gz

Download URL docx4j_xsdata-26.2.2.tar.gz
Size 471.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9c1526b0fe35a5e92db2f8ddd10730d56dd838e48a1fb61c712900b7d85d5c67
BLAKE2b-256 checksum
How to use checksums
cb7b32678ddd048029edeaaef9760f757447b066fe5acc70387db49a4641d76f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

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

Download URL docx4j_xsdata-26.2.2-py3-none-any.whl
Size 264.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47b903856661324a104de088851252d6c9555f5c6d6aeb288d841e6d2f939b51
BLAKE2b-256 checksum
How to use checksums
262b62f6af4d872b94bcbd9d173623a515f7dca0357eda55093be803db785af0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Security for docx4j-xsdata 26.2.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for docx4j_xsdata-26.2.2.tar.gz

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 Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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