Skip to main content

xmlpydict 📑

XML Tests PyPI versions PyPI

Requirements

  • python 3.8+

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!'}}

Goals

Create a consistent parsing strategy between XML and Python dictionaries using the specification found here. xmlpydict focuses on speed; see the benchmarks below.

small_xml_document large_xml_document

xmlpydict supports the following

CDataSection: CDATA Sections are stored as {'#text': CData}.

Comments: Comments are tokenized for corectness, but have no effect in what is returned.

Element Tags: Allows for duplicate attributes, however only the latest defined will be taken.

Characters: Similar to CDATA text is stored as {'#text': Char} , however this text is stripped.

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

Attribute prefixing

# Change prefix from default "@" with keyword argument attr_prefix
>>> from xmlpydict import parse
>>> parse('<p width="10" height="5"></p>', attr_prefix="$")
{"p": {"$width": "10", "$height": "5"}}

Exceptions

# Grammar and structure of the xml_content is checked while parsing
>>> from xmlpydict import parse
>>> parse("<a></ a>")
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 5

Unsupported

Prolog / Enforcing Document Type Definition and Element Type Declarations

Entity Referencing

Namespaces

Release files for xmlpydict 0.0.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xmlpydict 0.0.20
File Size Uploaded
xmlpydict-0.0.20.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xmlpydict 0.0.20
File Interpreter ABI Platform
xmlpydict-0.0.20-cp310-cp310-manylinux1_x86_64.manylinux_2_34_x86_64.manylinux_2_5_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.5+ x86-64, Linux glibc 2.34+ x86-64 Details

Total release size: 156.6 kB

Release files / xmlpydict-0.0.20.tar.gz

Download URL xmlpydict-0.0.20.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
71613ad226b04767fe87ae3f1c874a14ffa3dbf060622b5f7592eb3785fc990b
BLAKE2b-256 checksum
How to use checksums
5e0380aff63a73dd7b9353c80de9b826350a74abb7c01ed7d857b145aa19ebc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release files / xmlpydict-0.0.20-cp310-cp310-manylinux1_x86_64.manylinux_2_34_x86_64.manylinux_2_5_x86_64.whl

Download URL xmlpydict-0.0.20-cp310-cp310-manylinux1_x86_64.manylinux_2_34_x86_64.manylinux_2_5_x86_64.whl
Size 147.4 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
d1f97c95fa6d6b5ee088aed5de0435c6e6456e217cdb550d65ccb1d95f336390
BLAKE2b-256 checksum
How to use checksums
eb0efddf321ef3fe53fd28ccbb25e7431475e4eabb1cd21fe4ba56d3100ff357
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.20 This release

2 release files

0.0.19

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page