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.3

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.3
File Size Uploaded Provenance Actions
docx4j_xsdata-26.2.3.tar.gz 483.3 kB With provenance Details for docx4j_xsdata-26.2.3.tar.gz

Built distribution (wheel)

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

Total release size: 751.1 kB

Release files / docx4j_xsdata-26.2.3.tar.gz

Download URL docx4j_xsdata-26.2.3.tar.gz
Size 483.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c6fab0ab4f249c1116a6903d167e1fc1d358e48b2fd0ec9e4b08b29aa12f6ace
BLAKE2b-256 checksum
How to use checksums
6abf9e22128adafdf63b1d3e0ac416c0f76e22d7dc982e32f3e9957081750ee3
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 24, 2026.

Transparency log

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

Download URL docx4j_xsdata-26.2.3-py3-none-any.whl
Size 267.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9abe405508f7b5d21269d95a47df8313640647fb5d02a0bf0eb5e1c58f579f3
BLAKE2b-256 checksum
How to use checksums
5f1aeb34314603fd6e044fa6b7f497e10defc432e2549cf48f9def51ce100967
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 24, 2026.

Transparency log

Security for docx4j-xsdata 26.2.3

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.3.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 24, 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