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-6/

XML Order Export

Create an XML document from order records, ensuring the payload is wrapped in an outer element that can use either a default tag or a caller-provided name. Sample input used across tests:

[
    {"order_id": 101, "customer": "Ada", "items": ["pen", "paper"]},
    {"order_id": 102, "customer": "Lin", "items": ["stapler"]}
]

Capabilities

Wraps with default root

  • Converting the sample orders without specifying a root name returns a bytes XML document that starts with an XML declaration and wraps all content inside the default outer element name. @test

Supports custom root tag

  • When the caller supplies a root tag name (e.g., "orders") and requests string output, the XML document uses that tag for the outer element while retaining the declaration and nested order details. @test

Normalizes invalid root names

  • Providing a root tag that is not a valid XML element name (e.g., starts with a digit) results in a valid wrapper element being generated (using the library's normalization) without dropping or reordering order data. @test

Implementation

@generates

API

from typing import Iterable, Mapping, Any, Union

def export_orders(records: Iterable[Mapping[str, Any]], root_tag: str | None = None, as_bytes: bool = True) -> Union[bytes, str]:
    """Convert order records into an XML document with an outer wrapper element."""

Dependencies { .dependencies }

dicttoxml { .dependency }

Converts Python objects into XML documents with configurable wrapping.