OW_NAMESPACE::XMLNode Class Reference

Base class used to represent an XML tag such as <name> and contains all of the attributes and the value of such an XML tag. More...

#include <OW_XMLNode.hpp>

Collaboration diagram for OW_NAMESPACE::XMLNode:

Collaboration graph
[legend]
List of all members.

Public Types

typedef XMLNodeImplRef XMLNode::* safe_bool

Public Member Functions

 XMLNode (const String &name, const XMLAttributeArray &attrArray)
 Constructor taking the XML tag name and the attributes object from the SAX parser.
 XMLNode (const String &name)
 Constructor taking the XML tag name object from the SAX parser.
 XMLNode ()
 Constructs an empty XMLNode.
 XMLNode (const XMLNode &arg)
 Copy constructor.
XMLNodeoperator= (const XMLNode &arg)
 Copy constructor for an XMLNode.
 ~XMLNode ()
void setToNULL ()
 Sets the current node to NULL and will free any children or siblings this node may have.
String getName () const
 Gets the name of the node which came from the XML tag this node was created from.
void assignText (const String &text) const
 Sets the text value for the XMLNode.
void appendText (const String &text) const
 Add the given text to the existing text of the node.
String getAttribute (const String &name) const
 Searches the attributes of the current node for the attribute name and returns the value.
void addAttribute (const XMLAttribute &attr) const
 Adds the argument attribute to the Node's attribute array.
String mustGetAttribute (const String &name) const
 Same as getAttribute but if the attribute is not found a CIMException will be thrown.
XMLAttributeArray getAttrs () const
 Gets the attribute array for the currrent node.
String getText () const
 Returns the XML value of the current node.
XMLNode findElement (const char *elementName) const
 Compares the elementToken to the current node and to all of the current node's siblings and returns the node that matches.
XMLNode mustFindElement (const char *elementName) const
 Same as findElement but will throw an exception if the elementToken is not matched.
XMLNode nextElement (const char *elementName)
 Gets the next XMLNode unless it does not exist or the elementToken does not match.
XMLNode mustNextElement (const char *elementName) const
 Same as nextElement but it throws and exception if either the next node is NULL or it does not match elementToken.
void mustElement (const char *elementName) const
 Matches elementToken with the current node or throws an exception.
XMLNode mustElementChild (const char *elementName) const
 Same as mustElement but returns the child of the current node after matching elementToken.
XMLNode mustChildElement (const char *elementName) const
 Returns the child node of the current node if the child node matches the elementToken.
XMLNode mustChildElementChild (const char *elementName) const
 Returns the current node's child's child if the current node's child matches the elementToken.
XMLNode mustChildFindElement (const char *elementName) const
 Gets the child of the current node and search the child and the child's siblings to match the elementToken.
XMLNode findElementChild (const char *elementName) const
 Same as findElement but it returns the child of the matched node.
XMLNode mustFindElementChild (const char *elementName) const
 Same as findElementChild but it throws an exception if anything goes wrong.
XMLNode mustChildFindElementChild (const char *elementName) const
 Same as mustFindElementChild but it starts the search at the child of current node.
void setNext (const XMLNode &node) const
 Sets the current node's next sibling to node.
XMLNode getNext () const
 Gets the current node's next sibling.
void addChild (const XMLNode &node) const
 Adds the node as a child of the current node.
XMLNode getChild () const
 Gets the current node's child.
XMLNode mustGetChild () const
 Gets the current node's child and throws an exception if the child is NULL.
XMLNodeArray getChildren () const
 Gets the current node's children.
void printNode (std::ostream &ostr) const
 Prints the node in UTF8 format.
String toString () const
 Returns formatted xml representation of node in String.
 operator safe_bool () const
bool operator! () const

Private Member Functions

 XMLNode (const XMLNodeImplRef &ref)

Private Attributes

XMLNodeImplRef m_impl

Friends

class XMLNodeImpl

Detailed Description

Base class used to represent an XML tag such as <name> and contains all of the attributes and the value of such an XML tag.

Author:
Calvin R. Gaisford
Version:
1.0
Since:
1/26/2001

Definition at line 65 of file OW_XMLNode.hpp.


Member Typedef Documentation

typedef XMLNodeImplRef XMLNode::* OW_NAMESPACE::XMLNode::safe_bool
 

Definition at line 405 of file OW_XMLNode.hpp.


Constructor & Destructor Documentation

OW_NAMESPACE::XMLNode::XMLNode const String name,
const XMLAttributeArray attrArray
 

Constructor taking the XML tag name and the attributes object from the SAX parser.

Parameters:
name The XML tag name. If the XML tag were <foo> then name would contain the string "foo"
attrArray XMLAttributeArray containing the XML attributes that were associated with this node (XML Tag)

Definition at line 442 of file OW_XMLNode.cpp.

OW_NAMESPACE::XMLNode::XMLNode const String name  ) 
 

Constructor taking the XML tag name object from the SAX parser.

Parameters:
name The XML tag name. If the XML tag were <foo> then name would contain the string "foo"

Definition at line 453 of file OW_XMLNode.cpp.

OW_NAMESPACE::XMLNode::XMLNode  ) 
 

Constructs an empty XMLNode.

Definition at line 459 of file OW_XMLNode.cpp.

Referenced by findElement(), findElementChild(), getChild(), getNext(), mustChildElement(), mustChildElementChild(), mustChildFindElement(), mustChildFindElementChild(), mustElementChild(), mustFindElement(), mustFindElementChild(), mustGetChild(), mustNextElement(), and nextElement().

OW_NAMESPACE::XMLNode::XMLNode const XMLNode arg  ) 
 

Copy constructor.

Definition at line 436 of file OW_XMLNode.cpp.

OW_NAMESPACE::XMLNode::~XMLNode  ) 
 

Definition at line 465 of file OW_XMLNode.cpp.

OW_NAMESPACE::XMLNode::XMLNode const XMLNodeImplRef ref  )  [private]
 

Definition at line 448 of file OW_XMLNode.cpp.


Member Function Documentation

void OW_NAMESPACE::XMLNode::addAttribute const XMLAttribute attr  )  const
 

Adds the argument attribute to the Node's attribute array.

Parameters:
attr XMLAttribute to add.

Definition at line 501 of file OW_XMLNode.cpp.

References m_impl.

void OW_NAMESPACE::XMLNode::addChild const XMLNode node  )  const
 

Adds the node as a child of the current node.

Parameters:
node XMLNode to be set as the current node's first child. Any child set as the current child node will be set as the next sibling to the node added

Definition at line 641 of file OW_XMLNode.cpp.

References m_impl.

void OW_NAMESPACE::XMLNode::appendText const String text  )  const
 

Add the given text to the existing text of the node.

Definition at line 494 of file OW_XMLNode.cpp.

References m_impl.

void OW_NAMESPACE::XMLNode::assignText const String text  )  const
 

Sets the text value for the XMLNode.

Parameters:
text String containing the value to be set

Definition at line 487 of file OW_XMLNode.cpp.

References m_impl.

XMLNode OW_NAMESPACE::XMLNode::findElement const char *  elementName  )  const
 

Compares the elementToken to the current node and to all of the current node's siblings and returns the node that matches.

Parameters:
elementToken int holding the value of the elementToken to look for
Returns:
XMLNode which has a token matching elementToken

Definition at line 543 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::findElementChild const char *  elementName  )  const
 

Same as findElement but it returns the child of the matched node.

Parameters:
elementToken int set to the value of the elementToken to match
Returns:
XMLNode which is the child of the matched node

Definition at line 606 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

String OW_NAMESPACE::XMLNode::getAttribute const String name  )  const
 

Searches the attributes of the current node for the attribute name and returns the value.

Parameters:
name String containing the attribute name to search for
Returns:
String containing the value of the attribute

Definition at line 508 of file OW_XMLNode.cpp.

References m_impl, and name.

XMLAttributeArray OW_NAMESPACE::XMLNode::getAttrs  )  const
 

Gets the attribute array for the currrent node.

Returns:
XMLAttributeArray holding the attributes of the current node

Definition at line 522 of file OW_XMLNode.cpp.

References m_impl.

XMLNode OW_NAMESPACE::XMLNode::getChild  )  const
 

Gets the current node's child.

Returns:
XMLNode which is the child of the current node

Definition at line 655 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNodeArray OW_NAMESPACE::XMLNode::getChildren  )  const
 

Gets the current node's children.

Returns:
XMLNodeArray containing child nodes

Definition at line 662 of file OW_XMLNode.cpp.

References m_impl.

String OW_NAMESPACE::XMLNode::getName  )  const
 

Gets the name of the node which came from the XML tag this node was created from.

Returns:
Returns an String object containing the name of the node

Definition at line 536 of file OW_XMLNode.cpp.

References m_impl.

XMLNode OW_NAMESPACE::XMLNode::getNext  )  const
 

Gets the current node's next sibling.

Returns:
XMLNode holding the next sibling of the current node

Definition at line 634 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

String OW_NAMESPACE::XMLNode::getText  )  const
 

Returns the XML value of the current node.

Amoung other things, if the current node is a CDATA, getText returns the text of the CDATA.

Returns:
String holding the XML value of the current node

Definition at line 529 of file OW_XMLNode.cpp.

References m_impl.

XMLNode OW_NAMESPACE::XMLNode::mustChildElement const char *  elementName  )  const
 

Returns the child node of the current node if the child node matches the elementToken.

Parameters:
elementToken int set to the elementToken value to match
Returns:
XMLNode child of the current node
Exceptions:
CIMException Thrown if any of the following happens: the current node is NULL, the child of the current node is null, the child of the current node does not match the elementToken

Definition at line 585 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::mustChildElementChild const char *  elementName  )  const
 

Returns the current node's child's child if the current node's child matches the elementToken.

Parameters:
elementToken int set to the value of the elementToken to match
Returns:
XMLNode current node's child's child
Exceptions:
CIMException Thrown if one of the following happens: The current node is NULL The child of the current node is NULL The child of the current node does not match elementToken The child of the child of the current node is NULL

Definition at line 592 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::mustChildFindElement const char *  elementName  )  const
 

Gets the child of the current node and search the child and the child's siblings to match the elementToken.

Parameters:
elementToken int set to the value of the elementToken to match
Returns:
XMLNode from the current node's child and siblings that matched the elementToken
Exceptions:
CIMException Thrown if one of the following happens: The current node is NULL the child of the current node is NULL the elementToken is not matched

Definition at line 599 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::mustChildFindElementChild const char *  elementName  )  const
 

Same as mustFindElementChild but it starts the search at the child of current node.

Parameters:
elementToken int set to the value of the elementToken to match
Returns:
XMLNode which is the child of the matched node
Exceptions:
CIMException Thrown if the XMLNode is not going to be one that matched the elementToken

Definition at line 620 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

void OW_NAMESPACE::XMLNode::mustElement const char *  elementName  )  const
 

Matches elementToken with the current node or throws an exception.

Parameters:
elementToken int set to the elementToken to match
Exceptions:
CIMException 

Definition at line 571 of file OW_XMLNode.cpp.

References m_impl.

XMLNode OW_NAMESPACE::XMLNode::mustElementChild const char *  elementName  )  const
 

Same as mustElement but returns the child of the current node after matching elementToken.

Throws and exception if the elementToken does not match the current node.

Parameters:
elementToken int set to the elementToken value to match
Returns:
XMLNode child of the current node
Exceptions:
CIMException Thrown if either the elementToken did not match the current node or the child node is NULL.

Definition at line 578 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::mustFindElement const char *  elementName  )  const
 

Same as findElement but will throw an exception if the elementToken is not matched.

Compares the elementToken to the current node and to all of the current node's siblings and returns the node that matches

Parameters:
elementToken int holding the value of the elementToken to look for
Returns:
XMLNode which has a token matching elementToken
Exceptions:
CIMException Thrown if the elementToken is not matched

Definition at line 550 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::mustFindElementChild const char *  elementName  )  const
 

Same as findElementChild but it throws an exception if anything goes wrong.

Parameters:
elementToken int set to the value of the elementToken to match
Returns:
XMLNode which is the child of the matched node
Exceptions:
CIMException Thrown if the XMLNode is not going to be one that matched the elementToken

Definition at line 613 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

String OW_NAMESPACE::XMLNode::mustGetAttribute const String name  )  const
 

Same as getAttribute but if the attribute is not found a CIMException will be thrown.

Parameters:
name String containing the attribute name to search for
Returns:
String containing the value of the attribute found
Exceptions:
CIMException thrown if the attribute name is not found

Definition at line 515 of file OW_XMLNode.cpp.

References m_impl, and name.

XMLNode OW_NAMESPACE::XMLNode::mustGetChild  )  const
 

Gets the current node's child and throws an exception if the child is NULL.

Returns:
XMLNode which is the child of the current node
Exceptions:
CIMException Thrown if the child of the current node is NULL.

Definition at line 648 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::mustNextElement const char *  elementName  )  const
 

Same as nextElement but it throws and exception if either the next node is NULL or it does not match elementToken.

Parameters:
elementToken int value of the token to match
Returns:
XMLNode of the next node if it not NULL and matches elementToken
Exceptions:
CIMException Thrown if either the next node is NULL or the elementToken does not match

Definition at line 564 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

XMLNode OW_NAMESPACE::XMLNode::nextElement const char *  elementName  ) 
 

Gets the next XMLNode unless it does not exist or the elementToken does not match.

Parameters:
elementToken int value of the token to match
Returns:
XMLNode of the next node if it not NULL and matches elementToken

Definition at line 557 of file OW_XMLNode.cpp.

References m_impl, and XMLNode().

OW_NAMESPACE::XMLNode::operator safe_bool  )  const [inline]
 

Definition at line 406 of file OW_XMLNode.hpp.

References m_impl.

bool OW_NAMESPACE::XMLNode::operator!  )  const [inline]
 

Definition at line 408 of file OW_XMLNode.hpp.

XMLNode & OW_NAMESPACE::XMLNode::operator= const XMLNode arg  ) 
 

Copy constructor for an XMLNode.

Parameters:
arg 
Returns:

Definition at line 471 of file OW_XMLNode.cpp.

References m_impl.

void OW_NAMESPACE::XMLNode::printNode std::ostream &  ostr  )  const
 

Prints the node in UTF8 format.

Parameters:
iostream& to print to

Definition at line 669 of file OW_XMLNode.cpp.

References m_impl.

Referenced by OW_NAMESPACE::operator<<().

void OW_NAMESPACE::XMLNode::setNext const XMLNode node  )  const
 

Sets the current node's next sibling to node.

Parameters:
node XMLNode to be set as the current node's next sibling. Any node current set as the current node's next sibling will be removed and deleted and replaced by node.

Definition at line 627 of file OW_XMLNode.cpp.

References m_impl.

void OW_NAMESPACE::XMLNode::setToNULL  ) 
 

Sets the current node to NULL and will free any children or siblings this node may have.

Definition at line 479 of file OW_XMLNode.cpp.

References m_impl.

String OW_NAMESPACE::XMLNode::toString  )  const
 

Returns formatted xml representation of node in String.

Parameters:
XMLNode node to format
Returns:
String containing formatted xml

Definition at line 676 of file OW_XMLNode.cpp.

References m_impl.


Friends And Related Function Documentation

friend class XMLNodeImpl [friend]
 

Definition at line 427 of file OW_XMLNode.hpp.


Member Data Documentation

XMLNodeImplRef OW_NAMESPACE::XMLNode::m_impl [private]
 

Definition at line 421 of file OW_XMLNode.hpp.

Referenced by addAttribute(), addChild(), appendText(), assignText(), findElement(), findElementChild(), getAttribute(), getAttrs(), getChild(), getChildren(), getName(), getNext(), getText(), mustChildElement(), mustChildElementChild(), mustChildFindElement(), mustChildFindElementChild(), mustElement(), mustElementChild(), mustFindElement(), mustFindElementChild(), mustGetAttribute(), mustGetChild(), mustNextElement(), nextElement(), operator safe_bool(), operator=(), printNode(), setNext(), setToNULL(), and toString().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:17:09 2006 for openwbem by  doxygen 1.4.6