RapidXML.h File Reference
#include <WString.h>
#include <Print.h>
#include <debug_progmem.h>
#include "../../rapidxml/rapidxml.hpp"
Include dependency graph for RapidXML.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 XML
 

Macros

#define RAPIDXML_NO_EXCEPTIONS
 
#define RAPIDXML_NO_STREAMS
 

Typedefs

using XML::Document = rapidxml::xml_document< char >
 
using XML::Node = rapidxml::xml_node< char >
 
using XML::NodeType = rapidxml::node_type
 
using XML::Attribute = rapidxml::xml_attribute< char >
 

Functions

 DECLARE_FSTR (FS_xmlns_xml)
 
 DECLARE_FSTR (FS_xmlns_xmlns)
 
Node * XML::insertDeclaration (Document &doc)
 Add a declaration to the document if there isn't one already. More...
 
bool XML::deserialize (Document &doc, char *content)
 De-serialise XML text into a document. More...
 
static bool XML::deserialize (Document &doc, String &content)
 
bool XML::deserialize (Document &doc, const FlashString &content)
 
size_t XML::serialize (const Node &node, String &buffer, bool pretty=false)
 Serialize XML text and append to string buffer. More...
 
String XML::serialize (const Node &node, bool pretty=false)
 
size_t XML::serialize (const Node &node, Print &out, bool pretty=false)
 
static size_t XML::serialize (const Node &node, Print *out, bool pretty=false)
 
Node * XML::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. More...
 
static Node * XML::appendNode (Node *parent, const String &name, const String &value=nullptr)
 
Node * XML::appendNode (Node *parent, const String &name, const FlashString &value)
 
template<typename TString , typename TValue >
Node * XML::appendNode (Node *parent, const TString &name, const TValue &value)
 
Attribute * XML::appendAttribute (Node *node, const char *name, const char *value, size_t name_size=0, size_t value_size=0)
 Append an attribute. More...
 
static Attribute * XML::appendAttribute (Node *node, const String &name, const String &value)
 
template<typename TString , typename TValue >
Attribute * XML::appendAttribute (Node *node, const TString &name, const TValue &value)
 
Gets child node by relative path
Parameters
doc
pathNode path using slash as separator
nsOptional namespace
Return values
Node*nullptr if none is found

Leading/trailing separators are not permitted.

Node * XML::getNode (Node *node, const char *path, const char *ns, size_t ns_len=0)
 
Node * XML::getNode (Node *node, const String &path, const String &ns=nullptr)
 
Gets node from a document by path
Parameters
doc
pathNode path using slash as separator
nsOptional namespace
Return values
Node*nullptr if none is found

Leading separator is important: if present, search starts at root node. If omitted, first element must match the root node name.

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

Node * XML::getNode (const Document &doc, const char *path, const char *ns=nullptr, size_t ns_len=0)
 
Node * XML::getNode (const Document &doc, const String &path, const String &ns=nullptr)
 
Get node value
Parameters
node
name
name_size
Return values
Stringinvalid if node or name not found
String XML::getValue (const Node *node, const char *name, size_t name_size, const char *ns=nullptr, size_t ns_size=0)
 
String XML::getValue (const Node *node, const char *name, const char *ns=nullptr)
 
String XML::getValue (const Node *node, const String &name, const String &ns=nullptr)
 
Get attribute value
Parameters
node
name
name_size
Return values
Stringinvalid if node or name not found
String XML::getAttribute (const Node *node, const char *name, size_t name_size)
 
String XML::getAttribute (const Node *node, const char *name)
 
String XML::getAttribute (const Node *node, const String &name)
 

Macro Definition Documentation

◆ RAPIDXML_NO_EXCEPTIONS

#define RAPIDXML_NO_EXCEPTIONS

◆ RAPIDXML_NO_STREAMS

#define RAPIDXML_NO_STREAMS

Function Documentation

◆ DECLARE_FSTR() [1/2]

DECLARE_FSTR ( FS_xmlns_xml  )

◆ DECLARE_FSTR() [2/2]

DECLARE_FSTR ( FS_xmlns_xmlns  )