xmlify
result = xmlify(value)
Input: value · Output: result
What it is
Converts any value (any Value) to an XML string — see "The Value<->XML mapping" below.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = xmlify(value) | value stringnot documented yet | result string | Returns a string. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
t = parse_csv("name,age\nAlice,30\nBob,25\n")
print(xmlify(t))
# <table>
# <columns>
# <column kind="str">name</column>
# <column kind="num">age</column>
# </columns>
# <row>
# <name>Alice</name>
# <age>30</age>
# </row>
# <row>
# <name>Bob</name>
# <age>25</age>
# </row>
# </table>
back = parse_xml(xmlify(t))
print(back.name[0]) # Alice
j = csv2json("product,price\nWidget,9.99\n")
print(j) # [{"product":"Widget","price":9.99}]
output
<table>
<columns>
<column kind="str">name</column>
<column kind="num">age</column>
</columns>
<row>
<name>Alice</name>
<age>30</age>
</row>
<row>
<name>Bob</name>
<age>25</age>
</row>
</table>
... 2 more linesfrom file-io