refactor: rename DTree to DValue

This commit is contained in:
udo
2026-06-12 11:05:52 +00:00
parent 941f5aea08
commit 7066da3cde
157 changed files with 1203 additions and 1074 deletions
+8 -8
View File
@@ -1,6 +1,6 @@
:sig
String xml_encode(DTree t)
String xml_encode(DTree t, String root_name)
String xml_encode(DValue t)
String xml_encode(DValue t, String root_name)
:params
t : tree to serialize as XML
@@ -11,11 +11,11 @@ return value : XML string
>markup
xml_decode
json_encode
0_DTree
0_DValue
html_escape
:content
Serializes a `DTree` into a simple XML string.
Serializes a `DValue` into a simple XML string.
`xml_encode()` does not validate against a schema, DTD, or namespace rules. It is a structural converter for application data, similar in spirit to `json_encode()`.
@@ -33,11 +33,11 @@ node["children"] = list of child element nodes
Example:
```uce
DTree book;
DValue book;
book["name"] = "book";
book["attrs"]["id"] = "b1";
DTree title;
DValue title;
title["name"] = "title";
title["text"] = "UCE & XML";
book["children"].push(title);
@@ -54,7 +54,7 @@ The result is:
For simple map/list/scalar trees, `xml_encode()` creates ordinary child elements:
```uce
DTree payload;
DValue payload;
payload["title"] = "Hello";
payload["count"] = "3";
@@ -73,4 +73,4 @@ Notes:
- Text and attribute values are escaped.
- List values use repeated `<item>` children.
- Empty elements serialize as self-closing tags.
- Map child order follows `DTree` map iteration order.
- Map child order follows `DValue` map iteration order.