Skip to main content

xsdata pydantic plugin

Project description

image

xsdata powered by pydantic!

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

Now powered by pydantic!

$ xsdata http://rss.cnn.com/rss/edition.rss --output pydantic
Parsing document edition.rss
Analyzer input: 9 main and 0 inner classes
Analyzer output: 9 main and 0 inner classes
Generating package: init
Generating package: generated.rss
class Rss(BaseModel):
    class Meta:
        name = "rss"

    model_config = ConfigDict(defer_build=True)
    version: float = field(
        metadata={
            "type": "Attribute",
            "required": True,
        }
    )
    channel: Channel = field(
        metadata={
            "type": "Element",
            "required": True,
        }
    )
>>> from xsdata_pydantic.bindings import XmlParser
>>> from urllib.request import urlopen
>>> from generated.rss import Rss
>>>
>>> parser = XmlParser()
>>> with urlopen("http://rss.cnn.com/rss/edition.rss") as rq:
...     result = parser.parse(rq, Rss)
...
>>> result.channel.item[2].title
'Vatican indicts 10 people, including a Cardinal, over an international financial scandal'
>>> result.channel.item[2].pub_date
'Sat, 03 Jul 2021 16:37:14 GMT'
>>> result.channel.item[2].link
'https://www.cnn.com/2021/07/03/europe/vatican-financial-scandal-intl/index.html'

Changelog: 24.5 (2024-05-08)

  • Support pydantic v2 models
  • Add missing parser/serializer shortcuts
  • General project maintenance

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xsdata_pydantic-24.5.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

xsdata_pydantic-24.5-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file xsdata_pydantic-24.5.tar.gz.

File metadata

  • Download URL: xsdata_pydantic-24.5.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for xsdata_pydantic-24.5.tar.gz
Algorithm Hash digest
SHA256 e3c8758133195657ece578537eda6c7ebd8419f77abf6b90fd4ced96e348129b
MD5 0a13d57a32b0bf909f6af3c56ff68699
BLAKE2b-256 855e6bc728d70460d9ad3982d05c3765179e3584fee6fa523d57b242e6e4c50f

See more details on using hashes here.

File details

Details for the file xsdata_pydantic-24.5-py3-none-any.whl.

File metadata

File hashes

Hashes for xsdata_pydantic-24.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bb6da7d3445d655640096c65c1b11037153b19df533da89553f24247ef352cd0
MD5 bd5e66dc581fb24b30e59750ee75c1fa
BLAKE2b-256 b77b785fe71aa1138d7380ab3926cbb9571896d56544901c320953ff8a586926

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page