class XmlTag : private Moveable<XmlTag>
This class simplifies the task of creating XML output text. It provides means of formatting XML tags and attributes and outputs String.
XmlTag& Tag(const char *s)
Sets the name of tag.
String operator()()
Returns the completed XML tag block with empty content. E.g. <mytag></mytag>.
String operator()(const char *text)
String operator()(const String& text)
Returns the completed XML tag block with text content. E.g. <mytag>mytext</mytag>. Note that the text here is not altered in the output in any way - it can contain other subtags.
String Text(const char *text, byte charset = CHARSET_DEFAULT)
String Text(const String& s, byte charset = CHARSET_DEFAULT)
Returns the completed XML tag block with text content. In this case, text is converted from charset to UTF-8 encoding and escaped with entities.
String PreservedText(const char *s, byte charset = CHARSET_DEFAULT)
String PreservedText(const String& s, byte charset = CHARSET_DEFAULT)
Returns the completed XML tag block with text content. In this case, text is converted from charset to UTF-8 encoding and escaped with entities. Unlike Text, this variant adds xml:space="preserved" attribute and escapes '\t' and '\n' with entities too.
XmlTag& operator()(const char *attr, const char *val)
XmlTag& operator()(const char *attr, int q)
XmlTag& operator()(const char *attr, double q)
These methods add XML tag attributes.
XmlTag()
Empty constructor. You have to use Tag method to set the tag name.
XmlTag(const char *tag)
Sets the tag name to tag.
String DeXml(const char *s, byte charset = CHARSET_DEFAULT, bool escapelf = false)
This function escapes string s encoded in charset with XML entities (like '<') while converting it to UTF-8. If escapelf.is true, '\n' is escaped as '&#x%0a;'.
Creates the header of XML file.
String XmlDecl(const char *text)
Creates the declaration element of XML.
String XmlDocType(const char *text)
Creates the DOCTYPE XML declaration element.
String XmlDoc(const char *name, const char *xmlbody)
Returns XmlHeader() + XmlDocType(name) + XmlTag(name)(xmlbody) - basically adds standard XML header to XML body.
Returns the comment element of XML.
String XmlPI(const char *text)
Creates the processing info element of XML.
|