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.

The nested class XmlOutputter::Node
Figure C-37. The nested class XmlOutputter::Node

Declaration

class Node

Constructors/Destructors

Node(string elementName, string content ="")

Constructs a Node with the given element name and a string value as content.

Node(string elementName, int numericContent)

Constructs a Node with 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 Node to this Node.

string toString( ) const

Returns the XML-formatted string representation of this Node.

Protected/Private Methods

static string asString(int value)

A Static method that returns a string containing value (private).

string attributesAsString( ) const

Returns this Node’s attributes as a string for XML output. (private).

string escape(string value) const

Returns value with certain characters replaced with their XML escaped equivalents. Characters that will be replaced include “<”, “>”, ...

Get Unit Test Frameworks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.