xsdata attrs plugin
Project description
xsdata powered by attrs!
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 attrs!
$ xsdata http://rss.cnn.com/rss/edition.rss --output attrs
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
@attr.s
class Rss:
class Meta:
name = "rss"
version: Optional[float] = attr.ib(
default=None,
metadata={
"type": "Attribute",
}
)
channel: Optional[Channel] = attr.ib(
default=None,
metadata={
"type": "Element",
}
)
>>> from xsdata_attrs.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.3 (2024-03-10)
- 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_attrs-24.3.tar.gz
(18.4 kB
view hashes)
Built Distribution
Close
Hashes for xsdata_attrs-24.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12a33b7b1b81f55c706cc193c21bb9ec53908c8f380da99839f4f14dff23c487 |
|
MD5 | cd603d3e8d169f433ef705883a1333ed |
|
BLAKE2b-256 | 3e6e6a49af7ff7eade8680a791dfaf9dc0ba9f24404b02b65680083d062d40f9 |