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

XML Output Configurator

A utility that converts Python mappings into XML with controllable declaration visibility, root wrapping, and encoding metadata.

Capabilities

Document output with declaration

  • With payload { "title": "Atlas", "version": 1 } and default options, returns XML that begins with an XML declaration containing the encoding and wraps all fields in a <response> root element. @test

Snippet output without wrapper

  • With payload { "status": "ok" } and options include_declaration=False and wrap_root=False, returns XML without any XML declaration and without a top-level wrapper element, containing only the element for status. @test

Custom root naming

  • With payload { "item": "value" } and root_name="dataset", include_declaration=True, wrap_root=True, the XML encloses entries under <dataset> instead of the default root tag. @test

Encoding metadata toggle

  • With payload { "note": "cafe" } and include_declaration=True, encoding="ISO-8859-1":
    • When include_encoding=True, the XML declaration includes encoding="ISO-8859-1".
    • When include_encoding=False, the XML declaration omits any encoding attribute while keeping the declaration line. @test

Implementation

@generates

API

from typing import Any, Mapping


def format_xml(
    payload: Mapping[str, Any],
    *,
    root_name: str = "response",
    include_declaration: bool = True,
    wrap_root: bool = True,
    encoding: str = "UTF-8",
    include_encoding: bool = True,
    return_bytes: bool = False,
) -> str | bytes:
    """
    Convert the payload to XML while honoring declaration visibility, root wrapping, and encoding metadata options.
    Returns a bytes object when return_bytes is True; otherwise returns a string.
    """

Dependencies { .dependencies }

dicttoxml { .dependency }

Provides XML conversion for Python data structures.