Skip to main content

xml to dictionary tool for python

Project description

xmlpydict 📑

XML Tests PyPI versions PyPI

Requirements

  • python 3.7+

Installation

To install xmlpydict, using pip:

pip install xmlpydict

Quickstart

>>> from xmlpydict import parse
>>> parse("<package><xmlpydict language='python'/></package>")
{'package': {'xmlpydict': {'@language': 'python'}}}
>>> parse("<person name='Matthew'>Hello!</person>")
{'person': {'@name': 'Matthew', '#text': 'Hello!'}}

Tags

dict.get(key[, default]) will not cause exceptions

# Empty tags are containers
>>> from xmlpydict import parse
>>> parse("<a></a>")
{'a': {}}
>>> parse("<a/>")
{'a': {}}
>>> parse("<a/>").get('href')
None
>>> parse("")
{}

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

xmlpydict-0.0.7.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

xmlpydict-0.0.7-cp310-cp310-manylinux_2_34_x86_64.whl (146.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.34+ x86-64

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