XML Namespace Reference

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

NodeinsertDeclaration (Document &doc)
 Add a declaration to the document if there isn't one already. More...
 

Typedef Documentation

◆ Attribute

using XML::Attribute = typedef rapidxml::xml_attribute<char>

◆ Document

using XML::Document = typedef rapidxml::xml_document<char>

◆ Node

using XML::Node = typedef rapidxml::xml_node<char>

◆ NodeType

using XML::NodeType = typedef rapidxml::node_type

Function Documentation

◆ appendAttribute() [1/3]

Attribute* XML::appendAttribute ( Node node,
const char *  name,
const char *  value,
size_t  name_size = 0,
size_t  value_size = 0 
)

Append an attribute.

Parameters
parentNode to append child to
nameName of attribute (copy taken)
valueValue string (copy taken)
Attribute*New attribute

◆ appendAttribute() [2/3]

static Attribute* XML::appendAttribute ( Node node,
const String name,
const String value 
)
inlinestatic

◆ appendAttribute() [3/3]

template<typename TString , typename TValue >
Attribute* XML::appendAttribute ( Node node,
const TString &  name,
const TValue &  value 
)

◆ appendNode() [1/4]

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.

Parameters
parentNode to append child to
nameName of child node (copy taken)
valueOptional node value (copy taken)
Return values
Node*Child node
Note
If provide, sizes do not include nul-terminator Node MUST already be added to the document tree

◆ appendNode() [2/4]

Node* XML::appendNode ( Node parent,
const String name,
const FlashString value 
)

◆ appendNode() [3/4]

static Node* XML::appendNode ( Node parent,
const String name,
const String value = nullptr 
)
inlinestatic

◆ appendNode() [4/4]

template<typename TString , typename TValue >
Node* XML::appendNode ( Node parent,
const TString &  name,
const TValue &  value 
)

◆ deserialize() [1/3]

bool XML::deserialize ( Document doc,
char *  content 
)

De-serialise XML text into a document.

Return values
boolfalse on parse error
Note
Document maintains references to content so MUST stay in scope for lifetime of doc, or until doc.clear() is called

◆ deserialize() [2/3]

bool XML::deserialize ( Document doc,
const FlashString content 
)

◆ deserialize() [3/3]

static bool XML::deserialize ( Document doc,
String content 
)
inlinestatic

◆ getAttribute() [1/3]

String XML::getAttribute ( const Node node,
const char *  name 
)
inline

◆ getAttribute() [2/3]

String XML::getAttribute ( const Node node,
const char *  name,
size_t  name_size 
)

◆ getAttribute() [3/3]

String XML::getAttribute ( const Node node,
const String name 
)
inline

◆ getNode() [1/4]

Node* XML::getNode ( const Document doc,
const char *  path,
const char *  ns = nullptr,
size_t  ns_len = 0 
)

◆ getNode() [2/4]

Node* XML::getNode ( const Document doc,
const String path,
const String ns = nullptr 
)
inline

◆ getNode() [3/4]

Node* XML::getNode ( Node node,
const char *  path,
const char *  ns,
size_t  ns_len = 0 
)

◆ getNode() [4/4]

Node* XML::getNode ( Node node,
const String path,
const String ns = nullptr 
)
inline

◆ getValue() [1/3]

String XML::getValue ( const Node node,
const char *  name,
const char *  ns = nullptr 
)
inline

◆ getValue() [2/3]

String XML::getValue ( const Node node,
const char *  name,
size_t  name_size,
const char *  ns = nullptr,
size_t  ns_size = 0 
)

◆ getValue() [3/3]

String XML::getValue ( const Node node,
const String name,
const String ns = nullptr 
)
inline

◆ insertDeclaration()

Node* XML::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)

◆ serialize() [1/4]

String XML::serialize ( const Node node,
bool  pretty = false 
)

◆ serialize() [2/4]

size_t XML::serialize ( const Node node,
Print out,
bool  pretty = false 
)

◆ serialize() [3/4]

static size_t XML::serialize ( const Node node,
Print out,
bool  pretty = false 
)
inlinestatic

◆ serialize() [4/4]

size_t XML::serialize ( const Node node,
String buffer,
bool  pretty = false 
)

Serialize XML text and append to string buffer.

Return values
size_tnumber of characters written