UCE Test: XML

xml_encode() and xml_decode() convert between XML strings and element-shaped DValue values without schema validation.

Encoded Element Tree

<book id="b1" type="reference"><title>UCE &amp; XML</title><chapter number="1">Structural conversion without schema validation.</chapter></book>

Decoded DValue

{"attrs": {"id": "b1", "type": "reference"}, "children": [{"name": "title", "text": "UCE & XML"}, {"attrs": {"number": "1"}, "name": "chapter", "text": "Structural conversion without schema validation."}], "name": "book"}

Simple Map Encoding

<payload><count>3</count><title>Hello</title></payload>

Decode Existing XML

Input XML:

<note priority="high"><to>UCE</to><body><![CDATA[5 < 6]]></body><symbol>&#x41;&#66;</symbol></note>

Decoded DValue:

{"attrs": {"priority": "high"}, "children": [{"name": "to", "text": "UCE"}, {"name": "body", "text": "5 < 6"}, {"name": "symbol", "text": "AB"}], "name": "note"}

xml_encode() docs | xml_decode() docs