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
+5 -31
View File
@@ -23,49 +23,18 @@ Try the live example in the [XML demo](../demo/xml.uce).
The native element shape is:
```text
node["name"] = "book"
node["attrs"]["id"] = "b1"
node["text"] = "optional text"
node["children"] = list of child element nodes
```
Example:
```uce
DValue book;
book["name"] = "book";
book["attrs"]["id"] = "b1";
DValue title;
title["name"] = "title";
title["text"] = "UCE & XML";
book["children"].push(title);
String xml = xml_encode(book);
```
The result is:
```xml
<book id="b1"><title>UCE &amp; XML</title></book>
```
For simple map/list/scalar trees, `xml_encode()` creates ordinary child elements:
```uce
DValue payload;
payload["title"] = "Hello";
payload["count"] = "3";
String xml = xml_encode(payload, "payload");
```
Result:
```xml
<payload><count>3</count><title>Hello</title></payload>
```
Notes:
@@ -74,3 +43,8 @@ Notes:
- List values use repeated `<item>` children.
- Empty elements serialize as self-closing tags.
- Map child order follows `DValue` map iteration order.
:example
DValue value;
value["name"] = "Ada";
print(xml_encode(value) != "" ? "xml\n" : "empty\n");