xsdata


Namexsdata JSON
Version 24.4 PyPI version JSON
download
home_pageNone
SummaryPython XML Binding
upload_time2024-04-01 05:14:30
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords xsd wsdl schema dtd binding xml json dataclasses generator cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![image](https://github.com/tefra/xsdata/raw/main/docs/logo.svg)](https://xsdata.readthedocs.io/)

# Naive XML Bindings for python

[![image](https://github.com/tefra/xsdata/workflows/tests/badge.svg)](https://github.com/tefra/xsdata/actions)
[![image](https://readthedocs.org/projects/xsdata/badge)](https://xsdata.readthedocs.io/)
[![image](https://codecov.io/gh/tefra/xsdata/branch/main/graph/badge.svg)](https://codecov.io/gh/tefra/xsdata)
[![image](https://img.shields.io/github/languages/top/tefra/xsdata.svg)](https://xsdata.readthedocs.io/)
[![image](https://www.codefactor.io/repository/github/tefra/xsdata/badge)](https://www.codefactor.io/repository/github/tefra/xsdata)
[![image](https://img.shields.io/pypi/pyversions/xsdata.svg)](https://pypi.org/pypi/xsdata/)
[![image](https://img.shields.io/pypi/v/xsdata.svg)](https://pypi.org/pypi/xsdata/)

---

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](https://github.com/tefra/xsdata-w3c-tests).

## Getting started

```console
$ # Install all dependencies
$ pip install xsdata[cli,lxml,soap]
```

```console
$ # Generate models
$ xsdata tests/fixtures/primer/order.xsd --package tests.fixtures.primer
```

```python
>>> 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](https://xsdata.readthedocs.io) 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: 24.3.1 (2024-03-10)

**Fixes**

- Unnest class with circular reference
  ([#974](https://github.com/tefra/xsdata/pull/974))

## Changelog: 24.4 (2024-04-01)

**Features**

- Add xml and lxml tree serializers ([#975](https://github.com/tefra/xsdata/pull/975))
- Capture namespace prefixes in user dicts
  ([#978](https://github.com/tefra/xsdata/pull/978))
- Add cli option to generate wrapper fields
  ([#982](https://github.com/tefra/xsdata/pull/982))
- Support wrapper fields in JSON data bindings
  ([#982](https://github.com/tefra/xsdata/pull/982))
- Use abstract suffixes to resolve class name conflicts
  ([#985](https://github.com/tefra/xsdata/pull/985))
- Add the version number in the cli cache key
  ([#990](https://github.com/tefra/xsdata/pull/990))
- Use unicodedata.name for attrs with only special characters
  ([#993](https://github.com/tefra/xsdata/pull/993))
- Add src code excerpts on ruff errors
  ([#996](https://github.com/tefra/xsdata/pull/996))
- Detect circular imports and raise appropriate error
  ([#999](https://github.com/tefra/xsdata/pull/999))
- Add support for Python 3.13 ([#1001](https://github.com/tefra/xsdata/pull/1001))
- Add cli debug messages with performance stats

**Fixes**

- Use deepcopy to clone codegen models
  ([#980](https://github.com/tefra/xsdata/pull/980))
- Generate type hints for compound fields with token elements
  ([#997](https://github.com/tefra/xsdata/pull/997))
- Protect prohibited attrs from turning into lists
  ([#998](https://github.com/tefra/xsdata/pull/998))
- Convert child attr to list when parent is list
  ([#998](https://github.com/tefra/xsdata/pull/998))

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xsdata",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "xsd, wsdl, schema, dtd, binding, xml, json, dataclasses, generator, cli",
    "author": null,
    "author_email": "Christodoulos Tsoulloftas <chris@komposta.net>",
    "download_url": "https://files.pythonhosted.org/packages/9c/31/6c556219fd5c79abca4a6205d9836d8ff50b480a8c9c2b8b329d4f84c1a8/xsdata-24.4.tar.gz",
    "platform": null,
    "description": "[![image](https://github.com/tefra/xsdata/raw/main/docs/logo.svg)](https://xsdata.readthedocs.io/)\n\n# Naive XML Bindings for python\n\n[![image](https://github.com/tefra/xsdata/workflows/tests/badge.svg)](https://github.com/tefra/xsdata/actions)\n[![image](https://readthedocs.org/projects/xsdata/badge)](https://xsdata.readthedocs.io/)\n[![image](https://codecov.io/gh/tefra/xsdata/branch/main/graph/badge.svg)](https://codecov.io/gh/tefra/xsdata)\n[![image](https://img.shields.io/github/languages/top/tefra/xsdata.svg)](https://xsdata.readthedocs.io/)\n[![image](https://www.codefactor.io/repository/github/tefra/xsdata/badge)](https://www.codefactor.io/repository/github/tefra/xsdata)\n[![image](https://img.shields.io/pypi/pyversions/xsdata.svg)](https://pypi.org/pypi/xsdata/)\n[![image](https://img.shields.io/pypi/v/xsdata.svg)](https://pypi.org/pypi/xsdata/)\n\n---\n\nxsData is a complete data binding library for python allowing developers to access and\nuse XML and JSON documents as simple objects rather than using DOM.\n\nThe code generator supports XML schemas, DTD, WSDL definitions, XML & JSON documents. It\nproduces simple dataclasses with type hints and simple binding metadata.\n\nThe included XML and JSON parser/serializer are highly optimized and adaptable, with\nmultiple handlers and configuration properties.\n\nxsData is constantly tested against the\n[W3C XML Schema 1.1 test suite](https://github.com/tefra/xsdata-w3c-tests).\n\n## Getting started\n\n```console\n$ # Install all dependencies\n$ pip install xsdata[cli,lxml,soap]\n```\n\n```console\n$ # Generate models\n$ xsdata tests/fixtures/primer/order.xsd --package tests.fixtures.primer\n```\n\n```python\n>>> from tests.fixtures.primer import PurchaseOrder\n>>> from xsdata.formats.dataclass.parsers import XmlParser\n>>>\n>>> parser = XmlParser()\n>>> order = parser.parse(\"tests/fixtures/primer/sample.xml\", PurchaseOrder)\n>>> order.bill_to\nUsaddress(name='Robert Smith', street='8 Oak Avenue', city='Old Town', state='PA', zip=Decimal('95819'), country='US')\n```\n\nCheck the [documentation](https://xsdata.readthedocs.io) for more \u2728\u2728\u2728\n\n## Features\n\n**Code Generator**\n\n- XML Schemas 1.0 & 1.1\n- WSDL 1.1 definitions with SOAP 1.1 bindings\n- DTD external definitions\n- Directly from XML and JSON Documents\n- Extensive configuration to customize output\n- Pluggable code writer for custom output formats\n\n**Default Output**\n\n- Pure python dataclasses with metadata\n- Type hints with support for forward references and unions\n- Enumerations and inner classes\n- Support namespace qualified elements and attributes\n\n**Data Binding**\n\n- XML and JSON parser, serializer\n- PyCode serializer\n- Handlers and Writers based on lxml and native xml python\n- Support wildcard elements and attributes\n- Support xinclude statements and unknown properties\n- Customize behaviour through config\n\n## Changelog: 24.3.1 (2024-03-10)\n\n**Fixes**\n\n- Unnest class with circular reference\n  ([#974](https://github.com/tefra/xsdata/pull/974))\n\n## Changelog: 24.4 (2024-04-01)\n\n**Features**\n\n- Add xml and lxml tree serializers ([#975](https://github.com/tefra/xsdata/pull/975))\n- Capture namespace prefixes in user dicts\n  ([#978](https://github.com/tefra/xsdata/pull/978))\n- Add cli option to generate wrapper fields\n  ([#982](https://github.com/tefra/xsdata/pull/982))\n- Support wrapper fields in JSON data bindings\n  ([#982](https://github.com/tefra/xsdata/pull/982))\n- Use abstract suffixes to resolve class name conflicts\n  ([#985](https://github.com/tefra/xsdata/pull/985))\n- Add the version number in the cli cache key\n  ([#990](https://github.com/tefra/xsdata/pull/990))\n- Use unicodedata.name for attrs with only special characters\n  ([#993](https://github.com/tefra/xsdata/pull/993))\n- Add src code excerpts on ruff errors\n  ([#996](https://github.com/tefra/xsdata/pull/996))\n- Detect circular imports and raise appropriate error\n  ([#999](https://github.com/tefra/xsdata/pull/999))\n- Add support for Python 3.13 ([#1001](https://github.com/tefra/xsdata/pull/1001))\n- Add cli debug messages with performance stats\n\n**Fixes**\n\n- Use deepcopy to clone codegen models\n  ([#980](https://github.com/tefra/xsdata/pull/980))\n- Generate type hints for compound fields with token elements\n  ([#997](https://github.com/tefra/xsdata/pull/997))\n- Protect prohibited attrs from turning into lists\n  ([#998](https://github.com/tefra/xsdata/pull/998))\n- Convert child attr to list when parent is list\n  ([#998](https://github.com/tefra/xsdata/pull/998))\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python XML Binding",
    "version": "24.4",
    "project_urls": {
        "Changelog": "https://xsdata.readthedocs.io/en/latest/changelog/",
        "Documentation": "https://xsdata.readthedocs.io/",
        "Homepage": "https://github.com/tefra/xsdata",
        "Source": "https://github.com/tefra/xsdata"
    },
    "split_keywords": [
        "xsd",
        " wsdl",
        " schema",
        " dtd",
        " binding",
        " xml",
        " json",
        " dataclasses",
        " generator",
        " cli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4bdfe002f045b9788e660d50921addc404cf73a3b260df6fd6a75110ebd558db",
                "md5": "7c13ff21ed684e7922ca01197ec4713a",
                "sha256": "5207b9ae15218ffb1b5a53d4b8b42b43829d728427d36e2b4d65dc0fa4b76b19"
            },
            "downloads": -1,
            "filename": "xsdata-24.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7c13ff21ed684e7922ca01197ec4713a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 229330,
            "upload_time": "2024-04-01T05:14:28",
            "upload_time_iso_8601": "2024-04-01T05:14:28.676699Z",
            "url": "https://files.pythonhosted.org/packages/4b/df/e002f045b9788e660d50921addc404cf73a3b260df6fd6a75110ebd558db/xsdata-24.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c316c556219fd5c79abca4a6205d9836d8ff50b480a8c9c2b8b329d4f84c1a8",
                "md5": "fc97aea089d41fd773fd990221a8b417",
                "sha256": "bbff8e7706dad9cd691e5eb0f47008edabae10c4e650759a4f56daab6d98b6c4"
            },
            "downloads": -1,
            "filename": "xsdata-24.4.tar.gz",
            "has_sig": false,
            "md5_digest": "fc97aea089d41fd773fd990221a8b417",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 339159,
            "upload_time": "2024-04-01T05:14:30",
            "upload_time_iso_8601": "2024-04-01T05:14:30.966802Z",
            "url": "https://files.pythonhosted.org/packages/9c/31/6c556219fd5c79abca4a6205d9836d8ff50b480a8c9c2b8b329d4f84c1a8/xsdata-24.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-01 05:14:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tefra",
    "github_project": "xsdata",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xsdata"
}
        
Elapsed time: 0.22660s