Converts a Python dictionary or other native data type into a valid XML string.
86
Transform a collection of article-like records into an XML document while preserving raw text content using CDATA sections. Each record becomes a child of the root element, and each key in the record becomes a child element name.
<![CDATA[...]]> so characters like < and & are not escaped. @test@generates
from typing import Iterable, Mapping, Union
def build_feed(entries: Iterable[Mapping[str, Union[str, int, float]]], root_name: str = "feed") -> bytes:
"""Convert entries to an XML document with CDATA-wrapped string content."""Serializes Python data structures to XML and can wrap values in CDATA sections.
Install with Tessl CLI
npx tessl i tessl/pypi-dicttoxmldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10