NXmlNode Class Reference

NXmlNode class represents the concept of a xml node. More...

Inheritance diagram for NXmlNode:

NObject

List of all members.

Public Types

enum  CopyMode { RECURSIVE, NONRECURSIVE }
 Enumerates copy modes for xml nodes. More...

Public Member Functions

 NXmlNode (void)
 Constructs a NXmlNode object.
 NXmlNode (const NString &name)
 Constructs a NXmlNode object.
 NXmlNode (const NString &name, const NString &data)
 Constructs a NXmlNode object.
 NXmlNode (const NXmlNode &other)
 Constructs a NXmlNode object.
 ~NXmlNode (void)
 Destroys a NXmlNode object.
void setName (const NString &name)
 Sets the name of the node.
NString getName (void) const
 Gets the name of the node.
void setData (const NString &data)
 Sets the data of the node.
NString getData (void) const
 Gets the data of the node.
bool isBlank (void) const
 Returns whether the node is blank or not.
bool isText (void) const
 Returns whether the node holds text data.
bool isNull (void) const
 Returns whether the node is null or not.
NXmlNode addChild (const NString &name)
 Adds a child node.
NXmlNode addChild (const NString &name, const NString &data)
 Adds a child node.
NXmlNode addNextSibling (const NString &name)
 Adds a sibling node.
NXmlNode addNextSibling (const NString &name, const NString &data)
 Adds a sibling node.
NXmlNode addPreviousSibling (const NString &name)
 Adds a sibling node.
NXmlNode addPreviousSibling (const NString &name, const NString &data)
 Adds a sibling node.
NXmlNode getChild (void)
 Gets the first child node.
NXmlNode getLast (void)
 Gets the last node.
NXmlNode getParent (void)
 Gets the parent node.
NXmlNode getNext (void)
 Gets the next sibling node.
NXmlNode getPrevious (void)
 Gets the previous sibling node.
bool hasChild (void) const
 Returns whether the node has a child or not.
bool hasLast (void) const
 Returns whether the node has a last node or not.
bool hasParent (void) const
 Returns whether the node has a parent node or not.
bool hasNext (void) const
 Returns whether the node has a next node or not.
bool hasPrevious (void) const
 Returns whether the node has a previous node or not.
const NXmlNode getChild (void) const
 Gets the first child node.
const NXmlNode getLast (void) const
 Gets the last node.
const NXmlNode getParent (void) const
 Gets the parent node.
const NXmlNode getNext (void) const
 Gets the next sibling node.
const NXmlNode getPrevious (void) const
 Gets the previous sibling node.
NXmlNodeaddProperty (const NString &name, const NString &data)
 Adds a property to the current object.
bool removeProperty (const NString &name)
 Removes a property of the current node.
NString getProperty (const NString &name) const
 Gets a property of the current object.
bool hasProperty (const NString &name) const
 Returns whether the current object has a property.
bool removeChild (void)
 Removes a child node.
bool removeChild (const NString &name)
 Removes a child node.
bool removeNextSibling (void)
 Removes a sibling node.
bool removeNextSibling (const NString &name)
 Removes a sibling node.
bool removePreviousSibling (void)
 Removes a sibling node.
bool removePreviousSibling (const NString &name)
 Removes a sibling node.
NXmlNode find (const NString &name)
 Finds a node.
const NXmlNode find (const NString &name) const
 Finds a node.
NXmlNode copy (const NXmlNode &other) const
 Recursively copy a node.
NXmlNodeoperator= (const NXmlNode &rhs)
 Copy a node.

Friends

class NXmlDocument
class NXmlReader
class NXmlWriter


Detailed Description

NXmlNode class represents the concept of a xml node.

Todo:
Support namespaces
See also:
http://www.xmlsoft.org/html/libxml-tree.html
Examples:

ex_nxmlwrite.cpp, xmlreader.cpp, and xmlreader.h.

Definition at line 48 of file nxmlnode.h.


Member Enumeration Documentation

enum CopyMode

Enumerates copy modes for xml nodes.

Enumerator:
RECURSIVE  Recursively copy nodes
NONRECURSIVE  Non-Recursive copy of nodes

Definition at line 60 of file nxmlnode.h.


Constructor & Destructor Documentation

NXmlNode ( const NString name  ) 

Constructs a NXmlNode object.

Parameters:
name The name of the node

Definition at line 35 of file nxmlnode.cpp.

NXmlNode ( const NString name,
const NString data 
)

Constructs a NXmlNode object.

Parameters:
name The name of the node
data The data of the node

Definition at line 43 of file nxmlnode.cpp.

NXmlNode ( const NXmlNode other  ) 

Constructs a NXmlNode object.

Parameters:
other A NXmlNode object which will be copied

Definition at line 50 of file nxmlnode.cpp.

References getNode().


Member Function Documentation

void setName ( const NString name  ) 

Sets the name of the node.

Parameters:
name The name of the node

Definition at line 82 of file nxmlnode.cpp.

References NString::toChar().

NString getName ( void   )  const

Gets the name of the node.

Returns:
The name of the node
Examples:
xmlreader.cpp.

Definition at line 91 of file nxmlnode.cpp.

void setData ( const NString data  ) 

Sets the data of the node.

Parameters:
data The data of the node

Definition at line 102 of file nxmlnode.cpp.

References NString::toChar().

NString getData ( void   )  const

Gets the data of the node.

Returns:
The data of the node
Examples:
xmlreader.cpp.

Definition at line 109 of file nxmlnode.cpp.

References isBlank().

bool isBlank ( void   )  const

Returns whether the node is blank or not.

Returns:
True if the node is blank. false otherwise
Examples:
xmlreader.cpp.

Definition at line 128 of file nxmlnode.cpp.

Referenced by getData().

bool isText ( void   )  const

Returns whether the node holds text data.

Returns:
True if the node holds text data or false otherwise
Examples:
xmlreader.cpp.

Definition at line 137 of file nxmlnode.cpp.

bool isNull ( void   )  const

Returns whether the node is null or not.

Returns:
True if the node is null. false otherwise
Note:
Note that this is different from isBlank. A blank node is a node with no name and (probably) no data. A null node simple does not exist.
Examples:
xmlreader.cpp.

Definition at line 146 of file nxmlnode.cpp.

NXmlNode addChild ( const NString name  ) 

Adds a child node.

Parameters:
name The name of the child node
Returns:
The child node
Examples:
ex_nxmlwrite.cpp.

Definition at line 182 of file nxmlnode.cpp.

References NXmlError::getLastError(), and NXmlNode().

NXmlNode addChild ( const NString name,
const NString data 
)

Adds a child node.

Parameters:
name The name of the child node
data The data of the child node
Returns:
The child node

Definition at line 199 of file nxmlnode.cpp.

References NXmlError::getLastError(), and NXmlNode().

NXmlNode addNextSibling ( const NString name  ) 

Adds a sibling node.

Parameters:
name The name of the node
Returns:
The sibling node

Definition at line 216 of file nxmlnode.cpp.

References NXmlError::getLastError(), and NXmlNode().

NXmlNode addNextSibling ( const NString name,
const NString data 
)

Adds a sibling node.

Parameters:
name The name of the sibling node
data The data of the sibling node
Returns:
The sibling node

Definition at line 233 of file nxmlnode.cpp.

References NXmlError::getLastError(), and NXmlNode().

NXmlNode addPreviousSibling ( const NString name  ) 

Adds a sibling node.

Parameters:
name The name of the sibling node
Returns:
The sibling node

Definition at line 250 of file nxmlnode.cpp.

References NXmlError::getLastError(), and NXmlNode().

NXmlNode addPreviousSibling ( const NString name,
const NString data 
)

Adds a sibling node.

Parameters:
name The name of the sibling node
data The data of the sibling node
Returns:
The sibling node

Definition at line 267 of file nxmlnode.cpp.

References NXmlError::getLastError(), and NXmlNode().

NXmlNode getChild ( void   ) 

Gets the first child node.

Returns:
The first child node or a null NXmlNode object if not existant
Examples:
xmlreader.cpp.

Definition at line 304 of file nxmlnode.cpp.

References NXmlNode().

NXmlNode getLast ( void   ) 

Gets the last node.

Returns:
The last node or a null NXmlNode object if not existant

Definition at line 309 of file nxmlnode.cpp.

References NXmlNode().

NXmlNode getParent ( void   ) 

Gets the parent node.

Returns:
The parent node or a null NXmlNode object if not existant

Definition at line 313 of file nxmlnode.cpp.

References NXmlNode().

NXmlNode getNext ( void   ) 

Gets the next sibling node.

Returns:
The next sibling node or a null NXmlNode object if not existant
Examples:
xmlreader.cpp.

Definition at line 318 of file nxmlnode.cpp.

References NXmlNode().

NXmlNode getPrevious ( void   ) 

Gets the previous sibling node.

Returns:
The previous sibling node or a null NXmlNode object if not existant

Definition at line 323 of file nxmlnode.cpp.

References NXmlNode().

bool hasChild ( void   )  const

Returns whether the node has a child or not.

Returns:
True if the node has a child or false otherwise
Examples:
xmlreader.cpp.

Definition at line 284 of file nxmlnode.cpp.

bool hasLast ( void   )  const

Returns whether the node has a last node or not.

Returns:
True if the node has a last node or false otherwise

Definition at line 288 of file nxmlnode.cpp.

bool hasParent ( void   )  const

Returns whether the node has a parent node or not.

Returns:
True if the node has a parent node or false otherwise
Note:
In most cases will return true, except if the node is the root node

Definition at line 292 of file nxmlnode.cpp.

bool hasNext ( void   )  const

Returns whether the node has a next node or not.

Returns:
True if the node has a next node or false otherwise

Definition at line 296 of file nxmlnode.cpp.

bool hasPrevious ( void   )  const

Returns whether the node has a previous node or not.

Returns:
True if the node has a previous node or false otherwise

Definition at line 300 of file nxmlnode.cpp.

const NXmlNode getChild ( void   )  const

Gets the first child node.

Returns:
The first child node or a null NXmlNode object if not existant

Definition at line 328 of file nxmlnode.cpp.

References NXmlNode().

const NXmlNode getLast ( void   )  const

Gets the last node.

Returns:
The last node or a null NXmlNode object if not existant

Definition at line 333 of file nxmlnode.cpp.

References NXmlNode().

const NXmlNode getParent ( void   )  const

Gets the parent node.

Returns:
The parent node or a null NXmlNode object if not existant

Definition at line 338 of file nxmlnode.cpp.

References NXmlNode().

const NXmlNode getNext ( void   )  const

Gets the next sibling node.

Returns:
The next sibling node or a null NXmlNode object if not existant

Definition at line 343 of file nxmlnode.cpp.

References NXmlNode().

const NXmlNode getPrevious ( void   )  const

Gets the previous sibling node.

Returns:
The previous sibling node or a null NXmlNode object if not existant

Definition at line 348 of file nxmlnode.cpp.

References NXmlNode().

NXmlNode & addProperty ( const NString name,
const NString data 
)

Adds a property to the current object.

Parameters:
name The name of the property
data The data of the property
Returns:
A reference to the current object
Examples:
ex_nxmlwrite.cpp.

Definition at line 353 of file nxmlnode.cpp.

References NXmlError::getLastError(), and NString::toChar().

bool removeProperty ( const NString name  ) 

Removes a property of the current node.

Parameters:
name The name of the property to be removed
Returns:
True if the property was removed or false otherwise

Definition at line 371 of file nxmlnode.cpp.

NString getProperty ( const NString name  )  const

Gets a property of the current object.

Parameters:
name The name of the property
Returns:
The data of the property
Examples:
xmlreader.cpp.

Definition at line 395 of file nxmlnode.cpp.

References NString::toChar().

bool hasProperty ( const NString name  )  const

Returns whether the current object has a property.

Parameters:
name The name of the property
Returns:
True if the object has the property or false otherwise
Examples:
xmlreader.cpp.

Definition at line 407 of file nxmlnode.cpp.

References NString::toChar().

bool removeChild ( void   ) 

Removes a child node.

Returns:
True if removed the child (ie. node was found and removed) or false otherwise

Definition at line 418 of file nxmlnode.cpp.

bool removeChild ( const NString name  ) 

Removes a child node.

Parameters:
name The name of the child node to be removed
Returns:
True if removed the child (ie. node was found and removed) or false otherwise

Definition at line 428 of file nxmlnode.cpp.

bool removeNextSibling ( void   ) 

Removes a sibling node.

Returns:
True if removed the sibling (ie. node was found and removed) or false otherwise

Definition at line 453 of file nxmlnode.cpp.

bool removeNextSibling ( const NString name  ) 

Removes a sibling node.

Parameters:
name The name of the sibling node to be removed
Returns:
True if removed the sibling (ie. node was found and removed) or false otherwise

Definition at line 463 of file nxmlnode.cpp.

bool removePreviousSibling ( void   ) 

Removes a sibling node.

Returns:
True if removed the sibling (ie. node was found and removed) or false otherwise

Definition at line 488 of file nxmlnode.cpp.

bool removePreviousSibling ( const NString name  ) 

Removes a sibling node.

Parameters:
name The name of the sibling node to be removed
Returns:
True if removed the sibling (ie. node was found and removed) or false otherwise

Definition at line 498 of file nxmlnode.cpp.

NXmlNode find ( const NString name  ) 

Finds a node.

Parameters:
name The name of the node
Returns:
The node or a null NXmlNode object if not found

Definition at line 523 of file nxmlnode.cpp.

References NXmlNode().

Referenced by find().

const NXmlNode find ( const NString name  )  const

Finds a node.

Parameters:
name The name of the node
Returns:
The node (const) or a null NXmlNode object if not found

Definition at line 545 of file nxmlnode.cpp.

References find().

NXmlNode copy ( const NXmlNode other  )  const

Recursively copy a node.

Parameters:
other The node to be copied
Returns:
A new NXmlNode object with the same data, child, etc as 'other'

Definition at line 549 of file nxmlnode.cpp.

References NXmlNode().

NXmlNode & operator= ( const NXmlNode rhs  ) 

Copy a node.

Parameters:
rhs The node to be copied
Returns:
A reference to the current object

Definition at line 561 of file nxmlnode.cpp.

References getNode().


The documentation for this class was generated from the following files:
Generated on Wed Mar 5 23:10:37 2008 for NemesisUtilitiesSystem by  doxygen 1.5.4