Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

xmlpp::Node Class Reference

Represents XML Nodes. More...

Inheritance diagram for xmlpp::Node:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::list< Node * > NodeList

Public Member Functions

 Node (_xmlNode *node)
virtual ~Node ()
std::string get_name () const
 Get the name of this node.

void set_name (const std::string &name)
 Set the name of this node.

void set_namespace (const std::string &ns_prefix)
 Set the namespace prefix used by the node If no such namespace prefix has been declared then this method will throw an exception.

std::string get_namespace_prefix () const
std::string get_namespace_uri () const
int get_line () const
 Discover at what line number this node occurs in the XML file.

NodeList get_children (const std::string &name=std::string())
 Obtain the list of child nodes.

const NodeList get_children (const std::string &name=std::string()) const
 Obtain the list of child nodes.

Elementadd_child (const std::string &name, const std::string &ns_prefix=std::string())
 Add a child element to this node.

void remove_child (Node *node)
 Remove the child node.

Nodeimport_node (const Node *node, bool recursive=true)
 Import node(s) from another document under this node, without affecting the source node.

std::string get_path () const
 Return the XPath of this node.

NodeSet find (const std::string &xpath) const
 Find nodes from a XPath expression.

_xmlNode * cobj ()
 Access the underlying libxml implementation.

const _xmlNode * cobj () const
 Access the underlying libxml implementation.


Detailed Description

Represents XML Nodes.

You should never new or delete Nodes. The Parser will create and manage them for you.


Member Typedef Documentation

typedef std::list<Node*> xmlpp::Node::NodeList
 


Constructor & Destructor Documentation

xmlpp::Node::Node _xmlNode *  node  )  [explicit]
 

virtual xmlpp::Node::~Node  )  [virtual]
 


Member Function Documentation

Element* xmlpp::Node::add_child const std::string &  name,
const std::string &  ns_prefix = std::string()
 

Add a child element to this node.

Parameters:
name The new node name
ns_prefix The namespace prefix. If the prefix has not been declared then this method will throw an exception.
Returns:
The newly-created element

const _xmlNode* xmlpp::Node::cobj  )  const
 

Access the underlying libxml implementation.

Reimplemented in xmlpp::Attribute.

_xmlNode* xmlpp::Node::cobj  ) 
 

Access the underlying libxml implementation.

Reimplemented in xmlpp::Attribute.

NodeSet xmlpp::Node::find const std::string &  xpath  )  const
 

Find nodes from a XPath expression.

const NodeList xmlpp::Node::get_children const std::string &  name = std::string()  )  const
 

Obtain the list of child nodes.

You may optionally obtain a list of only the child nodes which have a certain name.

Parameters:
name The names of the child nodes to get. If you do not specigy a name, then the list will contain all nodes, regardless of their names.
Returns:
The list of child nodes.

NodeList xmlpp::Node::get_children const std::string &  name = std::string()  ) 
 

Obtain the list of child nodes.

You may optionally obtain a list of only the child nodes which have a certain name.

Parameters:
name The names of the child nodes to get. If you do not specigy a name, then the list will contain all nodes, regardless of their names.
Returns:
The list of child nodes.

int xmlpp::Node::get_line  )  const
 

Discover at what line number this node occurs in the XML file.

Returns:
The line number.

std::string xmlpp::Node::get_name  )  const
 

Get the name of this node.

Returns:
The node's name.

Reimplemented in xmlpp::Attribute.

std::string xmlpp::Node::get_namespace_prefix  )  const
 

std::string xmlpp::Node::get_namespace_uri  )  const
 

std::string xmlpp::Node::get_path  )  const
 

Return the XPath of this node.

Node* xmlpp::Node::import_node const Node node,
bool  recursive = true
 

Import node(s) from another document under this node, without affecting the source node.

Parameters:
node The node to copy and insert under the current node.
recursive Whether to import the child nodes also. Defaults to true.
Returns:
The newly-created node.

void xmlpp::Node::remove_child Node node  ) 
 

Remove the child node.

Parameters:
node The child node to remove. This Node will be deleted and therefore unusable after calling this method.

void xmlpp::Node::set_name const std::string &  name  ) 
 

Set the name of this node.

Parameters:
name The new name for the node.

void xmlpp::Node::set_namespace const std::string &  ns_prefix  ) 
 

Set the namespace prefix used by the node If no such namespace prefix has been declared then this method will throw an exception.

Parameters:
ns_prefix The namespace prefix.


The documentation for this class was generated from the following file:
Generated on Wed May 5 22:52:45 2004 for libxml++ by doxygen 1.3.5