Xml Parser¶
| Spice | |
|---|---|
XmlParser struct¶
Recursive-descent XML parser. Use parseXml for one-shot parsing.
The parser handles a useful subset of XML 1.0: elements with attributes, self-closing tags, character data with the standard predefined entities (& < > " ') and numeric character references (&#NN; and &#xNN;), CDATA sections, comments and an optional XML declaration / processing instructions (which are skipped). DTDs, namespaces and external entities are not interpreted.
The XmlNode data model lives in "std/text/xml-node" and serialization in "std/text/xml-serializer".
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct an XML parser over the given input string
Parameters
| Name | Type | Description |
|---|---|---|
input |
const String& |
XML text to parse |
Methods¶
parse¶
| Spice | |
|---|---|
Parse the input string into an XML node tree
Returns: Result<XmlNode*> — Result holding the root XML node, or an error if the input is malformed
Functions¶
parseXml¶
| Spice | |
|---|---|
Parse an XML document and return the root element.
On success returns the root XmlNode (heap-allocated; the caller owns it). On failure returns an error describing the first problem encountered.
Parameters
| Name | Type | Description |
|---|---|---|
input |
const String& |
Returns: Result<XmlNode*>