xmlpp::Node Class Reference

Represents XML Nodes. More...

#include <libxml++/nodes/node.h>

Inheritance diagram for xmlpp::Node:

Inheritance graph
[legend]

List of all members.

Public Types

typedef std::map
< Glib::ustring, Glib::ustring
PrefixNsMap
 A map of namespace prefixes to namespace URIs.

Public Member Functions

Glib::ustring get_name () const
 Get the name of this node.
void set_name (const Glib::ustring& name)
 Set the name of this node.
void set_namespace (const Glib::ustring& ns_prefix)
 Set the namespace prefix used by the node.
int get_line () const
 Discover at what line number this node occurs in the XML file.
const Elementget_parent () const
 Get the parent element for this node.
Elementget_parent ()
 Get the parent element for this node.
const Nodeget_next_sibling () const
 Get the next sibling for this node.
Nodeget_next_sibling ()
 Get the next sibling for this node.
const Nodeget_previous_sibling () const
 Get the previous sibling for this node .
Nodeget_previous_sibling ()
 Get the previous sibling for this node.
NodeList get_children (const Glib::ustring& name=Glib::ustring())
 Obtain the list of child nodes.
const NodeList get_children (const Glib::ustring& name=Glib::ustring()) const
 Obtain the list of child nodes.
Elementadd_child (const Glib::ustring& name, const Glib::ustring& ns_prefix=Glib::ustring())
 Add a child element to this node.
Elementadd_child (xmlpp::Node* previous_sibling, const Glib::ustring& name, const Glib::ustring& ns_prefix=Glib::ustring())
 Add a child element to this node after the specified existing child node.
Elementadd_child_before (xmlpp::Node* next_sibling, const Glib::ustring& name, const Glib::ustring& ns_prefix=Glib::ustring())
 Add a child element to this node before the specified existing child 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.
Glib::ustring get_path () const
 Return the XPath of this node.
NodeSet find (const Glib::ustring& xpath) const
 Find nodes from a XPath expression.
NodeSet find (const Glib::ustring& xpath, const PrefixNsMap& namespaces) const
 Find nodes from a XPath expression.
_xmlNode* cobj ()
 Access the underlying libxml implementation.
const _xmlNode* cobj () const
 Access the underlying libxml implementation.

Protected Member Functions

_xmlNode* create_new_child_node (const Glib::ustring& name, const Glib::ustring& ns_prefix)
 Create the C instance ready to be added to the parent node.


Detailed Description

Represents XML Nodes.

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


Member Function Documentation

Element* xmlpp::Node::add_child ( xmlpp::Node previous_sibling,
const Glib::ustring name,
const Glib::ustring ns_prefix = Glib::ustring() 
)

Add a child element to this node after the specified existing child node.

Parameters:
previous_sibling An existing child node.
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

Element* xmlpp::Node::add_child ( const Glib::ustring name,
const Glib::ustring ns_prefix = Glib::ustring() 
)

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

Element* xmlpp::Node::add_child_before ( xmlpp::Node next_sibling,
const Glib::ustring name,
const Glib::ustring ns_prefix = Glib::ustring() 
)

Add a child element to this node before the specified existing child node.

Parameters:
next_sibling An existing child node.
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

NodeSet xmlpp::Node::find ( const Glib::ustring xpath,
const PrefixNsMap namespaces 
) const

Find nodes from a XPath expression.

Parameters:
xpath The XPath of the nodes.
namespaces A map of namespace prefixes to namespace URIs to be used while finding.

NodeSet xmlpp::Node::find ( const Glib::ustring xpath  )  const

Find nodes from a XPath expression.

Parameters:
xpath The XPath of the nodes.

const NodeList xmlpp::Node::get_children ( const Glib::ustring name = Glib::ustring()  )  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 Glib::ustring name = Glib::ustring()  ) 

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.

Glib::ustring xmlpp::Node::get_name (  )  const

Get the name of this node.

Returns:
The node's name.

Reimplemented in xmlpp::Attribute.

Node* xmlpp::Node::get_next_sibling (  ) 

Get the next sibling for this node.

Returns:
The next sibling

const Node* xmlpp::Node::get_next_sibling (  )  const

Get the next sibling for this node.

Returns:
The next sibling

Element* xmlpp::Node::get_parent (  ) 

Get the parent element for this node.

Returns:
The parent node

const Element* xmlpp::Node::get_parent (  )  const

Get the parent element for this node.

Returns:
The parent node

Glib::ustring xmlpp::Node::get_path (  )  const

Return the XPath of this node.

Returns:
The XPath of the node.

Node* xmlpp::Node::get_previous_sibling (  ) 

Get the previous sibling for this node.

Returns:
The previous sibling

const Node* xmlpp::Node::get_previous_sibling (  )  const

Get the previous sibling for this node .

Returns:
The previous sibling

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 Glib::ustring name  ) 

Set the name of this node.

Parameters:
name The new name for the node.

void xmlpp::Node::set_namespace ( const Glib::ustring 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.


Generated on Fri Apr 16 13:26:12 2010 for libxml++ by  doxygen 1.5.8