Skip to main content

This package converts xml files and xml strings to python dictionary objects.

Project description

xml_dict

A Python package for converting XML documents and XML strings to dictionaries.

Installation

pip install xml_dict

Usage

Basic Example

from xml_dict import xfile, xstring

# Convert XML file to dictionary
xml_file = "/path/to/file.xml"
result.dict = xfile(xml_file)

# Convert XML string to dictionary
xml_string = """
<root>
    <person>
        <name>John</name>
        <age>30</age>
    </person>
</root>
"""
result_dict = xstring(xml_string)

## Main Functions

### xstring(xml_string)
Converts XML string to dictionary.

- `xml_string`: XML string
- Returns: Dictionary object representation of XML string

### xfile(path)
Converts XML in file to dictionary.

- `path`: absolute or relative path to a xml file
- Returns: Dictionary object representation of XML in file

## License

This project is licensed under the MIT License.

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

dict_from_xml-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dict_from_xml-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file dict_from_xml-0.1.0.tar.gz.

File metadata

  • Download URL: dict_from_xml-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.2 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for dict_from_xml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ce5d4aa8ecff8d95276e05b2786fb2fa8448023766437ce5f10d6b8a3cb661c4
MD5 e8e0a816936358b71344020989ccecfd
BLAKE2b-256 109ee0d554828038632ac39dcfceb4f7471d35447e42dfcff65e88bc7dc452f4

See more details on using hashes here.

File details

Details for the file dict_from_xml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dict_from_xml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.2 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for dict_from_xml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a4458d648bde0f62095864c160b6f51c3c4fe5cab05f90eb96b5114c2f27dda
MD5 ab95a1d45aab4814cadfb845950a9ccd
BLAKE2b-256 a0ee0586458d3e1f173dba94cdf632233912eb135a0e3a975b24646fd9eb4593

See more details on using hashes here.

Supported by

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