RapidXML
This is a port of https://github.com/dwd/rapidxml with minimal patch, and additional support code for Sming.
API Documentation
-
namespace XML
Unnamed Group
-
bool deserialize(Document &doc, char *content)
De-serialise XML text into a document.
Note
Document maintains references to content so MUST stay in scope for lifetime of doc, or until doc.clear() is called
- Return values:
bool – false on parse error
-
bool deserialize(Document &doc, const FlashString &content)
Unnamed Group
Unnamed Group
-
Node *appendNode(Node *parent, const char *name, const char *value = nullptr, size_t name_size = 0, size_t value_size = 0)
Append a child element with optional value.
Note
If provide, sizes do not include nul-terminator Node MUST already be added to the document tree
- Parameters:
parent – Node to append child to
name – Name of child node (copy taken)
value – Optional node value (copy taken)
- Return values:
Node* – Child node
-
Node *appendNode(Node *parent, const String &name, const FlashString &value)
Unnamed Group
Gets child node by relative path
Leading/trailing separators are not permitted.
- param doc:
- param path:
Node path using slash as separator
- param ns:
Optional namespace
- retval Node*:
nullptr if none is found
Gets node from a document by path
Leading separator is important: if present, search starts at root node. If omitted, first element must match the root node name.
- param doc:
- param path:
Node path using slash as separator
- param ns:
Optional namespace
- retval Node*:
nullptr if none is found
Trailing separator is not allowed.
Example 1: /s:Body/u:GetContentResponse Will search for s:Body node that is a child of the root node. The node u:GetContentResponse should be child of the s:Body node
Example 2: s:Envelope/s:Body/u:GetContentResponse Will search for s:Body node that is a child of the root node named s:Envelope. The node u:GetContentResponse should be child of the s:Body node
Get node value
- param node:
- param name:
- param name_size:
- retval String:
invalid if node or name not found
Get attribute value
- param node:
- param name:
- param name_size:
- retval String:
invalid if node or name not found
Typedefs
-
using Document = rapidxml::xml_document<char>
-
using Node = rapidxml::xml_node<char>
-
using NodeType = rapidxml::node_type
-
using Attribute = rapidxml::xml_attribute<char>
Functions
-
Node *insertDeclaration(Document &doc)
Add a declaration to the document if there isn’t one already.
Note
By default, declarations are included when parsed during de-serialisation. If you need one in the output serialisation, call this function. (We’re talking about the “<?xml version=”1.0” ?>” at the start)
-
bool deserialize(Document &doc, char *content)
References
Used by
Basic Graphics Sample
UPnP Library
SoC support
esp32
esp32c2
esp32c3
esp32s2
esp32s3
esp8266
host
rp2040