Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

rdXMLNode Class Reference

A class for performing operations on XML nodes. More...

#include <rdXMLNode.h>

List of all members.

Static Public Member Functions

int GetNumberOfParents (const IDOM_Node *node)
 Get the number of paraents a node has.

IDOM_Element * AppendNewElement (IDOM_Node *node, const char *aTag, const char *aName=NULL)
 Create a new element and add it as a child to a specified parent node.

IDOM_Element * GetFirstChildElementByTagName (const IDOM_Node *aNode, const char *aTagName)
 Get the first child of this node that is an element and has the specified tag name.

IDOM_CharacterData * GetCDataSectionNode (const IDOM_Node *aNode)
 Get the last character data section node associated with a specified node.

IDOM_Text * GetTextNode (const IDOM_Node *aNode)
 Get the last text node of a specified node.

bool GetBool (const IDOM_Node *aNode)
int GetInt (const IDOM_Node *aNode)
 Interpret the value of this node as an int.

double GetDbl (const IDOM_Node *aNode)
 Interpret the value of this node as a double.

char * GetStr (const IDOM_Node *aNode)
 Interpret the value of this node as string (char *).

void SetBoolArray (IDOM_Node *aNode, int aN, const bool *aData)
 Set the text of a node to represent an array of booleans.

int GetBoolArray (const IDOM_Node *aNode, bool *&rData)
 Interpret the value of this node as an array of boolean variables.

void SetIntArray (IDOM_Node *aNode, int aN, const int *aData)
 Set the text of a node to represent an array of ints.

int GetIntArray (const IDOM_Node *aNode, int *&rData)
 Interpret the value of this node as an array of ints.

void SetDblArray (IDOM_Node *aNode, int aN, const double *aData)
 Set the text of a node to represent an array of doubles.

int GetDblArray (const IDOM_Node *aNode, double *&rData)
 Interpret the value of this node as an array of doubles.

void SetStrArray (IDOM_Node *aNode, int aN, char **rData)
 Set the text of a node to represent an array of strings.

int GetStrArray (const IDOM_Node *aNode, char **&rData)
 Interpret the value of this node as an array of strings.

void SetAttribute (IDOM_Node *aNode, const char *aName, const char *aValue)
 Set an attribute on an element node.

char * GetAttribute (IDOM_Node *aNode, const char *aName)
 Get an attribute of an element node.


Static Private Attributes

const int TABLIMIT = 128


Detailed Description

A class for performing operations on XML nodes.

The methods in this class are generally static methods that take an IDOM_Node as their first argument.

This product includes software developed by the Apache Software Foundation (http://www.apache.org/).

Version:
1.0
Author:
Frank C. Anderson


Member Function Documentation

IDOM_Element * rdXMLNode::AppendNewElement IDOM_Node *  node,
const char *  aTag,
const char *  aName = NULL
[static]
 

Create a new element and add it as a child to a specified parent node.

Parameters:
aParent Node to which to add the child element.
aTag Tag name of the element to be added.
aName Attribute name of the element.
Returns:
Child element. NULL is returned on an error.

char * rdXMLNode::GetAttribute IDOM_Node *  aNode,
const char *  aName
[static]
 

Get an attribute of an element node.

This method only operates on element nodes. If the node sent in is not an element node, no action is taken.

int rdXMLNode::GetBoolArray const IDOM_Node *  aNode,
bool *&  rData
[static]
 

Interpret the value of this node as an array of boolean variables.

If the specified node is a text node (IDOM_Text) then it itself is interpretted. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is interpretted from the specified node's last child that is a text node. If the specified node has no such child, rData is set to NULL and 0 is returned. The caller is responsible for deleting the returned array.

Parameters:
aNode Node from which to obtain the data.
rData Reference to a bool pointer. If there is no data, rData is set to NULL.
Returns:
Length of the array.

IDOM_CharacterData * rdXMLNode::GetCDataSectionNode const IDOM_Node *  aNode  )  [static]
 

Get the last character data section node associated with a specified node.

Parameters:
aNode Node for which to identify a character data section node.
Returns:
Character data section node. If aNode is a character data section node it is returned. Otherwise, aNode's children are searched, and the LAST character data section node child found is returned. If a character data section node is not found, NULL is returned.

double rdXMLNode::GetDbl const IDOM_Node *  aNode  )  [static]
 

Interpret the value of this node as a double.

If the specified node is a text node (IDOM_Text) then it itself is interpretted. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is interpretted from the specified node's last child that is a text node. If the specified node has no such child, 0 is returned.

Returns:
Value. If an error is encountered 0.0 is returned.

int rdXMLNode::GetDblArray const IDOM_Node *  aNode,
double *&  rData
[static]
 

Interpret the value of this node as an array of doubles.

If the specified node is a text node (IDOM_Text) then it itself is interpretted. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is interpretted from the specified node's last child that is a text node. If the specified node has no such child, rData is set to NULL and 0 is returned.

The caller is responsible for deleting the returned array.

Parameters:
aNode Node from which to obtain the data.
rData Reference to a double pointer. If there is no data, rData is set to NULL.
Returns:
Length of the array.

IDOM_Element * rdXMLNode::GetFirstChildElementByTagName const IDOM_Node *  aNode,
const char *  aTagName
[static]
 

Get the first child of this node that is an element and has the specified tag name.

Parameters:
aNode Node that is to be search for the child element.
aTagName Tag name of the desired child element.
Returns:
First child element node with a tag name aTagName. NULL is returned if no such element exists.

int rdXMLNode::GetInt const IDOM_Node *  aNode  )  [static]
 

Interpret the value of this node as an int.

If the specified node is a text node (IDOM_Text) then it itself is interpretted. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is interpretted from the specified node's last child that is a text node. If the specified node has no such child, 0 is returned.

Returns:
Value. If an error is encountered a 0 is returned.

int rdXMLNode::GetIntArray const IDOM_Node *  aNode,
int *&  rData
[static]
 

Interpret the value of this node as an array of ints.

If the specified node is a text node (IDOM_Text) then it itself is interpretted. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is interpretted from the specified node's last child that is a text node. If the specified node has no such child, rData is set to NULL and 0 is returned. The caller is responsible for deleting the returned array.

Parameters:
aNode Node from which to obtain the data.
rData Reference to a int pointer. If there is no data, rData is set to NULL.
Returns:
Length of the array.

int rdXMLNode::GetNumberOfParents const IDOM_Node *  node  )  [static]
 

Get the number of paraents a node has.

The owner document is included in this count.

Parameters:
aNode Node for which to count the number of parents.
Returns:
Number of parents including the owner document.

char * rdXMLNode::GetStr const IDOM_Node *  aNode  )  [static]
 

Interpret the value of this node as string (char *).

If the specified node is a text node (IDOM_Text) then it itself is interpretted. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is interpretted from the specified node's last child that is a text node. If the specified node has no such child, rData is set to NULL and 0 is returned.

Note that the caller is responsible for deleting the returned string.

Parameters:
aNode Node from which to obtain the data.
Returns:
Value. If an error is encountered NULL is returned.

int rdXMLNode::GetStrArray const IDOM_Node *  aNode,
char **&  rData
[static]
 

Interpret the value of this node as an array of strings.

If the specified node is a text node (IDOM_Text) then it itself is interpretted. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is interpretted from the specified node's last child that is a text node. If the specified node has no such child, rData is set to NULL and 0 is returned.

The caller is responsible for deleting the individual strings in the array as well as the array.

Parameters:
aNode Node from which to obtain the data.
rData Reference to an array of character pointers. If there is no data, rData is set to NULL.
Returns:
Length of the array.

IDOM_Text * rdXMLNode::GetTextNode const IDOM_Node *  aNode  )  [static]
 

Get the last text node of a specified node.

Parameters:
aNode Node for which to identify a text node.
Returns:
Text node. If aNode is a text node it is returned. Otherwise, aNode's children are searched, and the LAST text node child found is returned. If a text node is not found, NULL is returned.

void rdXMLNode::SetAttribute IDOM_Node *  aNode,
const char *  aName,
const char *  aValue
[static]
 

Set an attribute on an element node.

This method only operates on element nodes. If the node sent in is not an element node, no action is taken.

void rdXMLNode::SetBoolArray IDOM_Node *  aNode,
int  aN,
const bool *  aData
[static]
 

Set the text of a node to represent an array of booleans.

If the specified node is a text node (IDOM_Text) then it itself is modified. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is set on the specified node's last child that is a text node. If the specified node has no such child, a new text node is created and appended to the specified node as a child.

Parameters:
aNode Node on which to set the text data.
aN Size of the specified data array.
aData Data array.

void rdXMLNode::SetDblArray IDOM_Node *  aNode,
int  aN,
const double *  aData
[static]
 

Set the text of a node to represent an array of doubles.

If the specified node is a text node (IDOM_Text) then it itself is modified. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is set on the specified node's last child that is a text node. If the specified node has no such child, a new text node is created and appended to the specified node as a child.

Parameters:
aNode Node on which to set the text data.
aN Size of the specified data array.
aData Data array.

void rdXMLNode::SetIntArray IDOM_Node *  aNode,
int  aN,
const int *  aData
[static]
 

Set the text of a node to represent an array of ints.

If the specified node is a text node (IDOM_Text) then it itself is modified. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is set on the specified node's last child that is a text node. If the specified node has no such child, a new text node is created and appended to the specified node as a child.

Parameters:
aNode Node on which to set the text data.
aN Size of the specified data array.
aData Data array.

void rdXMLNode::SetStrArray IDOM_Node *  aNode,
int  aN,
char **  rData
[static]
 

Set the text of a node to represent an array of strings.

If the specified node is a text node (IDOM_Text) then it itself is modified. However, if the specified node is any other type of node (for example, an element node (IDOM_Element)), the data is set on the specified node's last child that is a text node. If the specified node has no such child, a new text node is created and added to the specified node as a child.

Parameters:
aNode Node on which to set the text data.
aN Size of the specified data array.
aData Data array.


The documentation for this class was generated from the following files:
Generated on Wed Aug 20 02:17:13 2003 for Simulation Software by doxygen1.3