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 .

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


 class Node 


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 "<", ">", "&", and quote symbols ( private ).


typedef std::pair<string,string> Attribute

Defines the type Attribute as a pair of string s ( private ).

typedef deque<Attribute> Attributes

Defines the type Attributes as a deque of Attribute ( private ).

typedef deque<Node *> Nodes

Defines the type Nodes as a deque of Node ( private ).

Attributes m_attributes

This Node 's attributes ( private ).

string m_content

The content of this Node ( private ).

string m_name

The name of this Node ( private ).

Nodes m_nodes

The child Node s of this Node ( private ).

Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net