Registry / serialization / data-to-xml

data-to-xml

JSON →
library1.0.14pypypiunverified

A simple Python library for converting dictionaries to XML strings. Current version 1.0.9, updated periodically on PyPI.

pip install data-to-xml
INSTALL
IMPORT
SIG · DATA-TO-XML
D
data-to-xml
serializationpythonv1.0.14
Install
1.5s avg
Import
Disk
14MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.14 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✓ —
✓ 1.6s
py 3.12
✓ —
✓ 1.5s
py 3.13
✓ —
✓ 1.4s
py 3.9
✕ build_error
✕ build_error
14MB installed
● package 14MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dicttoxml
from data_to_xml import dicttoxml
from dicttoxml import dicttoxml

Convert a dict to XML with optional root element and type attributes disabled.

from dicttoxml import dicttoxml my_dict = { 'name': 'Alice', 'age': 30, 'items': ['book', 'pen'] } xml_str = dicttoxml(my_dict, custom_root='person', attr_type=False) print(xml_str.decode() if isinstance(xml_str, bytes) else xml_str)
Debug
Known issues
gotchaThe function returns bytes (not str) by default in Python 3. You must decode if you expect a string.
fix
Use .decode('utf-8') on the result or wrap with str().
affects: all
gotchaThe 'attr_type' parameter defaults to True, which adds 'type' attributes (e.g., type="str") to each element. This often breaks XML schemas or downstream parsers.
fix
Explicitly set attr_type=False when calling dicttoxml().
affects: <2.0.0
deprecatedThe 'root' parameter (to set root element name) has been deprecated in favor of 'custom_root'.
fix
Use custom_root='your_name' instead of root='your_name'.
affects: >=1.0.9
Upgrade
Version history
1.0.14latest on PyPI · released May 17, 2026
Audit
Dependencies
lxmlrequiredUsed under the hood for XML generation; error if missing.
Agent activity
9 hits · last 30 days
node
8
Resources
data-to-xml — pip install data-to-xml · libregistry