xsdata
Python XML Binding
What it is and what it does
xsdata is a data binding library that bridges the gap between XML and JSON documents and Python code. It works in two phases: first, a code generator reads XML schemas, WSDL definitions, DTD files, or sample XML and JSON documents and produces strongly-typed Python dataclasses with metadata; second, optimized parsers and serializers let you load and save those documents as instances of the generated classes, avoiding manual DOM manipulation.
The library targets developers who work with structured XML or JSON data and want type safety. It includes a CLI tool for code generation, supports namespace-qualified elements and attributes, handles wildcards and xinclude statements, and offers multiple handler backends. The generated code is pure Python with type hints, making it compatible with modern tooling.
Use it for:
- Generate Python models from an existing XSD schema and parse XML documents into typed objects.
- Convert WSDL service definitions into Python dataclasses for SOAP client integration.
- Infer Python dataclasses directly from sample XML or JSON files without a formal schema.
- Serialize Python objects back to XML or JSON with full namespace support.
- Build tools that consume structured XML configuration or data files with type safety.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
xsdata generates Python dataclasses from XML schemas, WSDL, DTD, and JSON documents, then parses and serializes XML and JSON data using those generated models.
Yes. xsdata is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real problem for anyone working with XML schemas or WSDL in Python. The MIT license imposes no restrictions. It is suitable for production use in data binding, schema-driven code generation, and XML/JSON serialization workflows.
Install
xsdata on PyPI
pip
pip install xsdatauv
uv add xsdatapoetry
poetry add xsdataInstalling xsdata
Before you install
Low friction: pure Python wheel with a single runtime dependency (typing-extensions). The package is actively maintained with recent releases and no known vulnerabilities.
License in practice
MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute xsdata freely provided you retain the license notice.
Quickstart
pip install xsdata
xsdata generate schema.xsd --package models
from xsdata.formats.dataclass.parsers import XmlParser
parser = XmlParser()
obj = parser.parse('data.xml', MyElement)
Requires Python 3.10 or later. Optional CLI and SOAP support require additional dependencies (lxml, etc.).
Verify before relying
- Performance characteristics when parsing or generating code for very large schemas or documents.
- Completeness of W3C XML Schema 1.1 test suite coverage beyond the stated testing claim.
- Whether generated dataclasses work seamlessly with type checkers and IDE autocomplete.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 180 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,481,970/month — #2,606 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xsdata-26.2-py3-none-any.whl
Keywords: xsd, wsdl, schema, dtd, binding, xml, json, dataclasses, generator, cli
Tags
More Code Generators packages
Proto Plus wraps protocol buffers to provide…
permissive · top 1,000 on PyPI
CythonCython is a source code translator that…
permissive · top 1,000 on PyPI
asttokensAnnotates Python abstract syntax trees with the…
permissive · top 1,000 on PyPI
beartypeBeartype is a runtime type checker that…
permissive · top 1,000 on PyPI
llvmlitellvmlite provides a lightweight Python binding…
permissive · top 1,000 on PyPI
astorastor converts Python abstract syntax trees…
permissive · top 5,000 on PyPI
xsdata-pydanticGenerates pydantic models from XML and JSON…
permissive · top 15,000 on PyPI
PyXB-XPyXB-X generates Python classes from XMLSchema…
permissive · top 15,000 on PyPI
xml-pythonConverts XML documents into Python objects,…
copyleft · top 5,000 on PyPI
xmlschemaValidates XML documents against XSD schemas and…
permissive · top 5,000 on PyPI
cyboxParses, manipulates, and generates Cyber…
permissive · top 15,000 on PyPI
xmlunittestExtends Python's unittest framework to compare…
permissive · top 5,000 on PyPI
ome-typesParse and manipulate OME-XML microscopy…
permissive · top 15,000 on PyPI
sepaxmlGenerates SEPA XML payment files for direct…
permissive · top 15,000 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
pydantic-xmlPydantic-xml adds XML serialization and…
permissive · top 5,000 on PyPI