Skip to main content

Supports item (int, float, bool, str, unicode, datetime, none) and collection (list, set, tuple and dict, as well as iterable and dict-like objects) data types with arbitrary nesting for the collections. Items with a datetime type are converted to ISO format strings. Items with a none type become empty XML elements.

The root object passed into the dicttoxml function can be any of the supported data types.

To satisfy XML syntax, the method wraps all the dict keys/elements and values in a <root> … </root> element. However, this can be disabled to create XML snippets.

For lists of items, if each item is also a collection data type (lists, dict), the elements of that item are wrapped in a generic <item> … </item> element.

Each elements includes a type attribute with the data type. Note: datetime data types are converted into ISO format strings, and unicode and datetime data types get a str attribute.

Python -> XML integer int float float string str unicode str datetime str None null boolean bool list list set list tuple list dict dict

Elements with an unsupported data type raise a TypeError exception.

If an element name is invalid XML, it is rendered with the name “key” and the invalid name is included as a name attribute. E.g. { “^.{0,256}$”: “foo” } would be rendered <key name=”^.{0,256}$”>foo</key>. An exception is element names with spaces, which are converted to underscores.

This module should work in Python 2.6+ and Python 3.

Metadata

Release files for dicttoxml 1.3.6

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

Source distribution (sdist)

Source distribution for dicttoxml 1.3.6
File Size Uploaded Provenance Actions
dicttoxml-1.3.6.tar.gz 6.8 kB Without provenance Details for dicttoxml-1.3.6.tar.gz

Release files / dicttoxml-1.3.6.tar.gz

Download URL dicttoxml-1.3.6.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7450fc87cb3422dd1c18a8928d0154dbcee7023da30d0711c4f7186b6d2ebf67
BLAKE2b-256 checksum
How to use checksums
47907bc3ac279e180f3d6ea6cc368d87d3db53c80c80c7c5ae2c3c9b5512c15f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for dicttoxml 1.3.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.

Release history Release notifications | RSS feed

This release

1.3.6 This release

1 release file No provenance

1.0

0.9.1

0.9

0.8

0.7

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