xml_encode
lib callCapy
function xml_encode(value : any, root_name : string = "root") string
Description
xml_encode() encodes an any as XML. The default root name is root. Map entries retain insertion order as elements or attributes. XML does not preserve arbitrary map/list kind.
Cycles, values beyond the BRRB nesting or node limits, and unsupported nodes cause the complete encoding to fail. Opaque handles and callables are unsupported. Failure returns an empty string, not partial XML or an empty-element replacement. This API does not expose a structured encoding error.
Parameters
value : value to encode
root_name : root element name
Return Values
The XML source, or an empty string on encoding failure.
Example
Capy
print(xml_encode({name: "Ada"}), "\n")
Output
<Ada/>