xml_to_dict
A simple Python XML to Dictionary parser.
The package is based on this answer from Stack Overflow. It parses entities as well as attributes following this XML-to-JSON "specification".
I just added the from_nest function, which lets you retrieve a value from the nested dictionaries.
Install
pip3 install xml_to_dict --user
Usage
from xml_to_dict import XMLtoDict
sample_xml = (
'<response>'
'<results>'
'<user>'
'<name>Ezequiel</name>'
'<age>33</age>'
'<city>San Isidro</city>'
'</user>'
'<user>'
'<name>Belén</name>'
'<age>30</age>'
'<city>San Isidro</city>'
'</user>'
'</results>'
'</response>'
)
parser = XMLtoDict()
print(parser.parse(sample_xml)) # {'response': {'results': {'user': [{'name': 'Ezequiel', 'age': '33', 'city': 'San Isidro'}, {'name': 'Belén', 'age': '30', 'city': 'San Isidro'}]}}}
print(parser.value_from_nest('.*ser', sample_xml)) # [{'name': 'Ezequiel', 'age': '33', 'city': 'San Isidro'}, {'name': 'Belén', 'age': '30', 'city': 'San Isidro'}]
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch
- Commit your Changes
- Push to the Branch
- Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for xml-to-dict 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xml_to_dict-0.1.6.tar.gz | 2.7 kB | Without provenance | Details for xml_to_dict-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xml_to_dict-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for xml_to_dict-0.1.6-py3-none-any.whl |
Total release size: 6.4 kB
Release files / xml_to_dict-0.1.6.tar.gz
| Download URL | xml_to_dict-0.1.6.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01d4bbf548219af3b979177a8b63672aef8f2bd0a584a0711503f4a60b1694a7
|
|
BLAKE2b-256 checksum How to use checksums |
6bd1b492e9eaf2c552dba27247f92e972620fd57d47a7f79b6dc4d8c40fec1ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
|
Release files / xml_to_dict-0.1.6-py3-none-any.whl
| Download URL | xml_to_dict-0.1.6-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f312372bba121a72a204d40ed2dd91f4027f5ea14e236befcc6c0e5aed4044f
|
|
BLAKE2b-256 checksum How to use checksums |
3d0e0ed3711e4007d56ab432bfb956af9076213eae4ac6bd9c81ff3ea8e50f65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
|
Security for xml-to-dict 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.