# xml/stringify Convert a Deft value (compact or tree shape) to a compact XML element string. ## Syntax
[xml/stringify $v]
## Parameters - `$v` — an element in either shape. A map with a `:name` key plus `:attributes` or `:children` is a tree node; otherwise it is a compact object with exactly one key naming the element. ## Examples
[xml/stringify %{ "order" %{ "@id" "A1" "customer" "Ada" } }]
# => "<order id=\"A1\"><customer>Ada</customer></order>"

[xml/stringify %{ "feed" %{ "entry" @{"a" "b"} } }]
# => "<feed><entry>a</entry><entry>b</entry></feed>"

[xml/stringify %{ :name "p" :attributes %{ "class" "lead" }
                   :children @{"Hi " %{ :name "b" :children @{"there"} }} }]
# => "<p class=\"lead\">Hi <b>there</b></p>"
## Returns The element as a string — no `<?xml ?>` declaration and no DOCTYPE (prepend the prolog yourself when writing a file). Invalid content (bad names, XML-invalid characters, `--` in a comment, `?>` in a processing instruction, nested arrays/sets, or a compact root that is not a single-key map) returns `%Err{:message}` instead of emitting broken XML. `"@name"` keys become attributes, `"#text"` becomes character data, other keys are child elements (a vector writes the element once per item), and `nil` writes an empty element. Scalars become text; `&`, `<`, `>` (and `"`/whitespace controls in attributes) are escaped as references. ## See Also `xml/pretty`, `xml/parse`, `xml/load`