Name
XmlOutputter::Node
Description
The class
XmlOutputter::Node
(see Figure C-37) is a
nested class belonging to XmlOutputter. It
represents a node in an XML document.
XmlOutputter::Node is declared in
XmlOutputter.h and implemented in
XmlOutputter.cpp.
![]() |
Declaration
class Node
Constructors/Destructors
-
Node(string elementName, string content ="") Constructs a
Nodewith the given element name and astringvalue as content.-
Node(string elementName, int numericContent) Constructs a
Nodewith the given element name and a numeric value as content.-
virtual ~Node( ) A destructor.
Public Methods
-
void addAttribute(string attributeName, int numericValue) Adds an XML attribute with a numeric value to this
Node.-
void addAttribute(string attributeName, string value) Adds an XML attribute with a string value to this
Node.-
void addNode(Node *node) Adds a child
Nodeto thisNode.-
string toString( ) const Returns the XML-formatted
stringrepresentation of thisNode.
Protected/Private Methods
-
static string asString(int value) A Staticmethod that returns astringcontainingvalue(private).-
string attributesAsString( ) const Returns this
Node’s attributes as a string for XML output. (private).-
string escape(string value) const Returns
valuewith certain characters replaced with their XML escaped equivalents. Characters that will be replaced include “<”, “>”, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
