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

Typed XML Audit Feed

Generate an XML document for audit records where every element is annotated with its original Python type and date/boolean values are normalized for downstream consumers.

Capabilities

Annotates primitives with types

  • Converting a single record containing id=7, active=True, and created_at=datetime(2024, 1, 3, 15, 45, tzinfo=timezone.utc) returns an XML string where each element includes a type attribute, booleans render as true/false, and the datetime uses ISO-8601 with its timezone offset. @test

Preserves nested structures

  • When a record includes nested metadata such as {"flags": {"beta": False}, "window": {"start": datetime(2023, 12, 1, 8, 0, 0), "end": datetime(2023, 12, 1, 9, 0, 0)}}, the generated XML nests those sections and retains type annotations for all inner elements, with datetime values formatted in ISO-8601. @test

Handles multiple records

  • Given two records with differing boolean and datetime values, the output wraps each record entry in order and preserves type annotations and normalized values for every field across both records. @test

Implementation

@generates

API

from datetime import datetime, timezone
from typing import Iterable, Mapping, Any

def build_audit_xml(records: Iterable[Mapping[str, Any]]) -> str:
    """Return an XML document string that type-annotates elements and normalizes datetimes/booleans."""

Dependencies { .dependencies }

dicttoxml { .dependency }

Converts Python objects to XML while adding type attributes and normalizing datetime/boolean values. @satisfied-by