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
+6 -6
View File
@@ -1,19 +1,19 @@
:sig
DTree xml_decode(String s)
DValue xml_decode(String s)
:params
s : XML source string
return value : element-shaped DTree
return value : element-shaped DValue
:see
>markup
xml_encode
json_decode
0_DTree
0_DValue
String
:content
Parses a simple XML document into a structured `DTree`.
Parses a simple XML document into a structured `DValue`.
`xml_decode()` is intentionally small. It does not validate schemas, DTDs, namespaces, or document types. It parses the first root element and returns the same structural element shape accepted by `xml_encode()`.
@@ -31,7 +31,7 @@ node["children"] = list of child element nodes
Example:
```uce
DTree book = xml_decode("<book id=\"b1\"><title>UCE &amp; XML</title></book>");
DValue book = xml_decode("<book id=\"b1\"><title>UCE &amp; XML</title></book>");
book["name"].to_string(); // book
book["attrs"]["id"].to_string(); // b1
@@ -42,7 +42,7 @@ book["children"]["0"]["text"].to_string(); // UCE & XML
CDATA and numeric entities are folded into text:
```uce
DTree note = xml_decode("<note><![CDATA[5 < 6]]><symbol>&#x41;&#66;</symbol></note>");
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