Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/dicttoxml@1.7.x
tile.json

tessl/pypi-dicttoxml

tessl install tessl/pypi-dicttoxml@1.7.0

Converts a Python dictionary or other native data type into a valid XML string.

Agent Success

Agent success rate when using this tile

86%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.99x

Baseline

Agent success rate without this tile

87%

task.mdevals/scenario-9/

XML Payload Builder

A utility that converts structured Python data into XML while allowing callers to toggle automatic type annotations and per-element unique identifiers.

Capabilities

Toggle type annotations

  • With include_types=False and include_ids=False, converting { "title": "Guide", "pages": 2 } using root_name="book" produces XML bytes whose elements carry no type attributes while preserving both fields under the <book> root. @test

Unique ids on demand

  • With include_types=False and include_ids=True, converting [ {"name": "Ana"}, {"name": "Bo"} ] under root_name="users" returns XML bytes where each generated element (root, item wrappers, and field tags) includes an id attribute and all id values are unique across the document. @test

Combined controls

  • With include_types=True and include_ids=True, converting { "tasks": [ { "id": 101, "status": "open" } ] } under root_name="project" includes type attributes on every element and unique id attributes while preserving the list nesting. @test

Implementation

@generates

API

from typing import Any, Iterable, Mapping, Union


def build_xml_payload(
    data: Union[Mapping[str, Any], Iterable[Mapping[str, Any]]],
    include_types: bool = True,
    include_ids: bool = False,
    root_name: str = "records",
) -> bytes:
    """Convert mappings or iterables of mappings to XML bytes, honoring toggles for type annotations and per-element ids."""

Dependencies { .dependencies }

dicttoxml { .dependency }

Transforms Python data structures into XML with configurable type metadata and id attributes.