refactor: rename DTree to DValue
This commit is contained in:
@@ -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 & XML</title></book>");
|
||||
DValue book = xml_decode("<book id=\"b1\"><title>UCE & 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>AB</symbol></note>");
|
||||
DValue note = xml_decode("<note><![CDATA[5 < 6]]><symbol>AB</symbol></note>");
|
||||
|
||||
note["text"].to_string(); // 5 < 6
|
||||
note["children"]["0"]["text"].to_string(); // AB
|
||||
|
||||
Reference in New Issue
Block a user