|
libxml++
2.35.2
|
Represents XML Nodes. More...
#include <libxml++/nodes/node.h>


Public Types | |
| typedef std::list< Node* > | NodeList |
| typedef std::map < Glib::ustring, Glib::ustring > | PrefixNsMap |
| A map of namespace prefixes to namespace URIs. | |
Public Member Functions | |
| Node (_xmlNode* node) | |
| virtual | ~Node () |
| 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. | |
| Glib::ustring | get_namespace_prefix () const |
| Glib::ustring | get_namespace_uri () const |
| int | get_line () const |
| Discover at what line number this node occurs in the XML file. | |
| const Element* | get_parent () const |
| Get the parent element for this node. | |
| Element* | get_parent () |
| Get the parent element for this node. | |
| const Node* | get_next_sibling () const |
| Get the next sibling for this node. | |
| Node* | get_next_sibling () |
| Get the next sibling for this node. | |
| const Node* | get_previous_sibling () const |
| Get the previous sibling for this node . | |
| Node* | get_previous_sibling () |
| Get the previous sibling for this node. | |
| const Node* | get_first_child (const Glib::ustring& name=Glib::ustring()) const |
| Get the first child of this node. | |
| Node* | get_first_child (const Glib::ustring& name=Glib::ustring()) |
| Get the first child of 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. | |
| Element* | add_child (const Glib::ustring& name, const Glib::ustring& ns_prefix=Glib::ustring()) |
| Add a child element to this node. | |
| Element* | 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. | |
| Element* | 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. | |
| void | remove_child (Node* node) |
| Remove the child node. | |
| Node* | import_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. | |
Static Public Member Functions | |
| static void | create_wrapper (_xmlNode* node) |
| Construct the correct C++ instance for a given libxml C struct instance. | |
| static void | free_wrappers (_xmlNode* attr) |
| Delete the C++ instance for a given libxml C struct instance, and also recursively destroy the C++ instances for any children. | |
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. | |
Represents XML Nodes.
You should never new or delete Nodes. The Parser will create and manage them for you.
| typedef std::list<Node*> xmlpp::Node::NodeList |
| typedef std::map<Glib::ustring, Glib::ustring> xmlpp::Node::PrefixNsMap |
A map of namespace prefixes to namespace URIs.
| xmlpp::Node::Node | ( | _xmlNode * | node | ) | [explicit] |
| virtual xmlpp::Node::~Node | ( | ) | [virtual] |
| Element* xmlpp::Node::add_child | ( | const Glib::ustring & | name, |
| const Glib::ustring & | ns_prefix = Glib::ustring() |
||
| ) |
Add a child element to this 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. |
| exception |
| 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.
| 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. |
| exception |
| 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.
| 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. |
| exception |
| _xmlNode* xmlpp::Node::cobj | ( | ) |
Access the underlying libxml implementation.
Reimplemented in xmlpp::Attribute, xmlpp::EntityDeclaration, and xmlpp::AttributeDeclaration.
| const _xmlNode* xmlpp::Node::cobj | ( | ) | const |
Access the underlying libxml implementation.
Reimplemented in xmlpp::Attribute, xmlpp::EntityDeclaration, and xmlpp::AttributeDeclaration.
| _xmlNode* xmlpp::Node::create_new_child_node | ( | const Glib::ustring & | name, |
| const Glib::ustring & | ns_prefix | ||
| ) | [protected] |
Create the C instance ready to be added to the parent node.
| static void xmlpp::Node::create_wrapper | ( | _xmlNode * | node | ) | [static] |
Construct the correct C++ instance for a given libxml C struct instance.
This is only for use by the libxml++ implementation.
node A pointer to an xmlNode or a "derived" struct, such as xmlDoc, xmlAttr, etc.
| NodeSet xmlpp::Node::find | ( | const Glib::ustring & | xpath | ) | const |
Find nodes from a XPath expression.
| xpath | The XPath of the nodes. |
| exception |
| NodeSet xmlpp::Node::find | ( | const Glib::ustring & | xpath, |
| const PrefixNsMap& | namespaces | ||
| ) | const |
Find nodes from a XPath expression.
| xpath | The XPath of the nodes. |
| namespaces | A map of namespace prefixes to namespace URIs to be used while finding. |
| exception |
| static void xmlpp::Node::free_wrappers | ( | _xmlNode * | attr | ) | [static] |
Delete the C++ instance for a given libxml C struct instance, and also recursively destroy the C++ instances for any children.
This is only for use by the libxml++ implementation. node A pointer to an xmlNode or a "derived" struct, such as xmlDoc, xmlAttr, etc.
| 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.
| 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. |
| 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.
| 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. |
| const Node* xmlpp::Node::get_first_child | ( | const Glib::ustring & | name = Glib::ustring() | ) | const |
Get the first child of this node.
You may optionally get the first child node which has a certain name.
| Node* xmlpp::Node::get_first_child | ( | const Glib::ustring & | name = Glib::ustring() | ) |
Get the first child of this node.
You may optionally get the first child node which has a certain name.
| int xmlpp::Node::get_line | ( | ) | const |
Discover at what line number this node occurs in the XML file.
| Glib::ustring xmlpp::Node::get_name | ( | ) | const |
| Glib::ustring xmlpp::Node::get_namespace_uri | ( | ) | const |
| const Node* xmlpp::Node::get_next_sibling | ( | ) | const |
Get the next sibling for this node.
Get the next sibling for this node.
| const Element* xmlpp::Node::get_parent | ( | ) | const |
Get the parent element for this node.
Get the parent element for this node.
| Glib::ustring xmlpp::Node::get_path | ( | ) | const |
Return the XPath of this node.
| const Node* xmlpp::Node::get_previous_sibling | ( | ) | const |
Get the previous sibling for this node .
Get the previous sibling for 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.
| node | The node to copy and insert under the current node. |
| recursive | Whether to import the child nodes also. Defaults to true. |
| exception |
| void xmlpp::Node::remove_child | ( | Node* | node | ) |
Remove the child node.
| 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.
| 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.
| ns_prefix | The namespace prefix. |
| exception |
1.7.6.1