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

Inventory XML Exporter

Generate an XML feed from product records for partner ingestion.

Capabilities

Serialize products with ids

  • Transforms an iterable of product dictionaries into XML wrapped by an <inventory> root, emitting each entry as a <product> element with sequential id attributes when ID annotations are enabled. Nested dictionaries become nested tags. @test

Metadata toggle

  • When include_types is true, element nodes carry type metadata attributes; when false, no type metadata appears anywhere in the output. @test

Text wrapping

  • When use_cdata is true, string values are wrapped in CDATA sections instead of being entity-escaped. @test

Output encoding

  • When as_bytes is true, the function returns bytes that include the XML declaration; otherwise it returns a Unicode string without changing the content. @test

Implementation

@generates

API

from typing import Iterable, Mapping, Any, Union

def build_inventory_xml(
    products: Iterable[Mapping[str, Any]],
    *,
    with_ids: bool = True,
    include_types: bool = True,
    use_cdata: bool = False,
    as_bytes: bool = False
) -> Union[bytes, str]:
    """Convert products into an inventory XML feed."""

Dependencies { .dependencies }

dicttoxml { .dependency }

Converts Python objects to XML with controllable root naming, id metadata, type annotations, CDATA wrapping, and byte/string outputs.