Python XML Binding
Project Links
Meta
Author: Christodoulos Tsoulloftas
Requires Python: >=3.9
Classifiers
Intended Audience
- Developers
License
- OSI Approved :: MIT License
Operating System
- OS Independent
Programming Language
- Python
- Python :: 3
- Python :: 3 :: Only
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
Topic
- Software Development :: Code Generators
- Text Processing :: Markup :: XML
Naive XML Bindings for python
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 xsdata[cli,lxml,soap]
$ # Generate models
$ xsdata generate tests/fixtures/primer/order.xsd --package tests.fixtures.primer
>>> from tests.fixtures.primer import PurchaseOrder
>>> from 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: 25.7 (2025-07-06)
Fixes
Jul 06, 2025
25.7
Apr 13, 2025
25.4
Dec 22, 2024
24.12
Nov 03, 2024
24.11
Sep 21, 2024
24.9
Jul 28, 2024
24.7
Jun 28, 2024
24.6.1
Jun 24, 2024
24.6
May 07, 2024
24.5
Apr 01, 2024
24.4
Mar 10, 2024
24.3.1
Mar 10, 2024
24.3
Feb 19, 2024
24.2.1
Feb 17, 2024
24.2
Jan 04, 2024
24.1
Aug 12, 2023
23.8
Jul 23, 2023
23.7
Jun 24, 2023
23.6
May 21, 2023
23.5
Dec 17, 2022
22.12
Nov 06, 2022
22.11
Sep 24, 2022
22.9
Aug 21, 2022
22.8
Jul 17, 2022
22.7
May 08, 2022
22.5
Apr 10, 2022
22.4
Mar 20, 2022
22.3
Feb 06, 2022
22.2
Jan 23, 2022
22.1
Dec 05, 2021
21.12
Nov 02, 2021
21.11
Sep 04, 2021
21.9
Aug 03, 2021
21.8
Jul 01, 2021
21.7
Jun 01, 2021
21.6
May 07, 2021
21.5
Apr 02, 2021
21.4
Mar 04, 2021
21.3
Feb 02, 2021
21.2
Jan 08, 2021
21.1
Dec 10, 2020
20.12
Nov 13, 2020
20.11.1
Nov 10, 2020
20.11
Oct 02, 2020
20.10
Sep 03, 2020
20.9
Aug 01, 2020
20.8
Jul 04, 2020
20.7
Jun 01, 2020
20.6
May 23, 2020
20.5.5
May 16, 2020
20.5.4
May 15, 2020
20.5.2
May 14, 2020
20.5.1
May 02, 2020
20.5
Apr 21, 2020
20.4.2
Apr 13, 2020
20.4.1
Apr 01, 2020
20.4
Mar 01, 2020
20.3
Feb 09, 2020
20.2
Jan 26, 2020
20.1.3
Jan 14, 2020
20.1.2
Jan 08, 2020
20.1.1
Jan 07, 2020
20.1