xsdata pydantic plugin
Project description
xsdata powered by pydantic!
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
Release history Release notifications | RSS feed
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)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3c8758133195657ece578537eda6c7ebd8419f77abf6b90fd4ced96e348129b |
|
MD5 | 0a13d57a32b0bf909f6af3c56ff68699 |
|
BLAKE2b-256 | 855e6bc728d70460d9ad3982d05c3765179e3584fee6fa523d57b242e6e4c50f |
File details
Details for the file xsdata_pydantic-24.5-py3-none-any.whl
.
File metadata
- Download URL: xsdata_pydantic-24.5-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb6da7d3445d655640096c65c1b11037153b19df533da89553f24247ef352cd0 |
|
MD5 | bd5e66dc581fb24b30e59750ee75c1fa |
|
BLAKE2b-256 | b77b785fe71aa1138d7380ab3926cbb9571896d56544901c320953ff8a586926 |