cleanup, docs

This commit is contained in:
root
2026-06-16 12:21:31 +00:00
parent dff1959341
commit ea08d5f28b
296 changed files with 1571 additions and 1940 deletions
+4 -20
View File
@@ -21,32 +21,12 @@ Try the live example in the [XML demo](../demo/xml.uce).
Return shape:
```text
node["name"] = element name
node["attrs"] = map of attributes
node["text"] = text content when non-empty
node["children"] = list of child element nodes
```
Example:
```uce
DValue book = xml_decode("<book id=\"b1\"><title>UCE &amp; XML</title></book>");
book["name"].to_string(); // book
book["attrs"]["id"].to_string(); // b1
book["children"]["0"]["name"].to_string(); // title
book["children"]["0"]["text"].to_string(); // UCE & XML
```
CDATA and numeric entities are folded into text:
```uce
DValue note = xml_decode("<note><![CDATA[5 < 6]]><symbol>&#x41;&#66;</symbol></note>");
note["text"].to_string(); // 5 < 6
note["children"]["0"]["text"].to_string(); // AB
```
Supported parser features:
@@ -61,3 +41,7 @@ Supported parser features:
Whitespace-only text between child elements is ignored. Mixed non-empty text is concatenated into `node["text"]`.
Malformed XML raises a request-visible runtime error.
:example
DValue node = xml_decode("<root><name>Ada</name></root>");
print(node.is_array() ? "xml\n" : "empty\n");