XmlOutputter::Node

   
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 .

Figure C-37. The nested class XmlOutputter::Node
figs/utf_ac37.gif

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

Attributes


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 ).

     
Colophon

Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects.

The animal on the cover of Unit Test Frameworks is a Norway rat. Contrary to its name , the Norway rat's origins are in Asia; over the centuries, it has spread throughout the world. It is often blamed for transmitting the Black Plague through Europe, but another species, the black rat, is actually responsible for this. The Norway rat's appearance includes a brown or dark gray coat with a white or grayish underside, pointed ears, a long snout, and a scaly tail. It averages about 9 to 10 inches in length. It builds its own nest of twigs and leaves and is mostly nocturnal. It makes its habitat where food is most accessible and is typically found in cities, where it can root through garbage; near farms where it can forage through the harvest; and near the ocean, where it can eat fish, seaweed, and the like. It lives among large groups of other rats, usually with one male designated as the leader.

Along with the common house mouse, the Norway rat is the most popular animal model for scientific lab testing. (The lab rats are usually albino, however.) It is useful because its metabolism is very much like a human's and the rats often are affected by the same diseases and sicknesses as humans .

Mary Brady was the production editor and the copyeditor for Unit Test Frameworks . Colleen Gorman proofread the book. Matt Hutchinson and Claire Cloutier provided quality control. Ellen Troutman-Zaig wrote the index.

Ellie Volckhausen designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from the Dover Pictorial Archive. Clay Fernald produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font. David Futato designed and produced the CD label using Adobe InDesign CS.

Melanie Wang designed the interior layout, based on a series design by David Futato. This book was converted by Julie Hawks to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand MX and Adobe Photoshop CS. This colophon was written by Mary Brady.

The online edition of this book was created by the Safari production group (John Chodacki, Ken Douglass, and Ellie Cutler) using a set of Frame-to-XML conversion and cleanup tools written and maintained by Erik Ray, Benn Salter, John Chodacki, Ellie Cutler, and Jeff Liggett.