skillfed

xsdata

Python XML Binding

xsdata v26.2 3.5M downloads/30d#2,606 on PyPI446
Permissive license MIT Active released

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 xsdata

uv

uv add xsdata

poetry

poetry add xsdata

Installing 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

Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Code GeneratorsTopic :: Text Processing :: Markup :: XML

Tags

xml schema to python dataclassxml binding librarywsdl code generatorxml json parser serializerdtd to dataclassxml data bindingschema-driven code generation
code-generationxml-bindingschema-driven

More Code Generators packages