Note: xml_node does not allocate any memory for the node it wraps; it only wraps a pointer to existing node.
Public Types | |
typedef xml_node_iterator | iterator |
Node iterator type (for child nodes). | |
typedef xml_attribute_iterator | attribute_iterator |
Node iterator type (for child nodes). | |
Public Member Functions | |
xml_node () | |
Default ctor. | |
operator unspecified_bool_type () const | |
Safe bool conversion. | |
bool | operator! () const |
bool | operator== (const xml_node &r) const |
Compare wrapped pointer to the attribute to the pointer that is wrapped by r. | |
bool | operator!= (const xml_node &r) const |
Compare wrapped pointer to the attribute to the pointer that is wrapped by r. | |
bool | operator< (const xml_node &r) const |
Compare wrapped pointer to the attribute to the pointer that is wrapped by r. | |
bool | operator> (const xml_node &r) const |
Compare wrapped pointer to the attribute to the pointer that is wrapped by r. | |
bool | operator<= (const xml_node &r) const |
Compare wrapped pointer to the attribute to the pointer that is wrapped by r. | |
bool | operator>= (const xml_node &r) const |
Compare wrapped pointer to the attribute to the pointer that is wrapped by r. | |
iterator | begin () const |
Access the begin iterator for this node's collection of child nodes. | |
iterator | end () const |
Access the end iterator for this node's collection of child nodes. | |
attribute_iterator | attributes_begin () const |
Access the begin iterator for this node's collection of attributes. | |
attribute_iterator | attributes_end () const |
Access the end iterator for this node's collection of attributes. | |
bool | empty () const |
Check if node is empty. | |
xml_node_type | type () const |
Get node type. | |
const char_t * | name () const |
Get node name (element name for element nodes, PI target for PI). | |
const char_t * | value () const |
Get node value (comment/PI/PCDATA/CDATA contents, depending on node type). | |
xml_node | child (const char_t *name) const |
Get child with the specified name. | |
PUGIXML_DEPRECATED xml_node | child_w (const char_t *name) const |
Get child with the name that matches specified pattern. | |
xml_attribute | attribute (const char_t *name) const |
Get attribute with the specified name. | |
PUGIXML_DEPRECATED xml_attribute | attribute_w (const char_t *name) const |
Get attribute with the name that matches specified pattern. | |
xml_node | next_sibling (const char_t *name) const |
Get first of following sibling nodes with the specified name. | |
PUGIXML_DEPRECATED xml_node | next_sibling_w (const char_t *name) const |
Get first of the following sibling nodes with the name that matches specified pattern. | |
xml_node | next_sibling () const |
Get following sibling. | |
xml_node | previous_sibling (const char_t *name) const |
Get first of preceding sibling nodes with the specified name. | |
PUGIXML_DEPRECATED xml_node | previous_sibling_w (const char_t *name) const |
Get first of the preceding sibling nodes with the name that matches specified pattern. | |
xml_node | previous_sibling () const |
Get preceding sibling. | |
xml_node | parent () const |
Get parent node. | |
xml_node | root () const |
Get root of DOM tree this node belongs to. | |
const char_t * | child_value () const |
Get child value of current node; that is, value of the first child node of type PCDATA/CDATA. | |
const char_t * | child_value (const char_t *name) const |
Get child value of child with specified name. | |
PUGIXML_DEPRECATED const char_t * | child_value_w (const char_t *name) const |
Get child value of child with name that matches the specified pattern. | |
bool | set_name (const char_t *rhs) |
Set node name to rhs (for PI/element nodes). | |
bool | set_value (const char_t *rhs) |
Set node value to rhs (for PI/PCDATA/CDATA/comment nodes). | |
xml_attribute | append_attribute (const char_t *name) |
Add attribute with specified name (for element nodes). | |
xml_attribute | insert_attribute_after (const char_t *name, const xml_attribute &attr) |
Insert attribute with specified name after attr (for element nodes). | |
xml_attribute | insert_attribute_before (const char_t *name, const xml_attribute &attr) |
Insert attribute with specified name before attr (for element nodes). | |
xml_attribute | append_copy (const xml_attribute &proto) |
Add a copy of the specified attribute (for element nodes). | |
xml_attribute | insert_copy_after (const xml_attribute &proto, const xml_attribute &attr) |
Insert a copy of the specified attribute after attr (for element nodes). | |
xml_attribute | insert_copy_before (const xml_attribute &proto, const xml_attribute &attr) |
Insert a copy of the specified attribute before attr (for element nodes). | |
xml_node | append_child (xml_node_type type=node_element) |
Add child node with specified type (for element nodes). | |
xml_node | insert_child_after (xml_node_type type, const xml_node &node) |
Insert child node with specified type after node (for element nodes). | |
xml_node | insert_child_before (xml_node_type type, const xml_node &node) |
Insert child node with specified type before node (for element nodes). | |
xml_node | append_copy (const xml_node &proto) |
Add a copy of the specified node as a child (for element nodes). | |
xml_node | insert_copy_after (const xml_node &proto, const xml_node &node) |
Insert a copy of the specified node after node (for element nodes). | |
xml_node | insert_copy_before (const xml_node &proto, const xml_node &node) |
Insert a copy of the specified node before node (for element nodes). | |
void | remove_attribute (const xml_attribute &a) |
Remove specified attribute. | |
void | remove_attribute (const char_t *name) |
Remove attribute with the specified name, if any. | |
void | remove_child (const xml_node &n) |
Remove specified child. | |
void | remove_child (const char_t *name) |
Remove child with the specified name, if any. | |
xml_attribute | first_attribute () const |
Get first attribute. | |
xml_attribute | last_attribute () const |
Get last attribute. | |
template<typename OutputIterator> | |
void | all_elements_by_name (const char_t *name, OutputIterator it) const |
Get all elements from subtree with given name. | |
template<typename OutputIterator> | |
PUGIXML_DEPRECATED void | all_elements_by_name_w (const char_t *name, OutputIterator it) const |
Get all elements from subtree with name that matches given pattern. | |
xml_node | first_child () const |
Get first child. | |
xml_node | last_child () const |
Get last child. | |
template<typename Predicate> | |
xml_attribute | find_attribute (Predicate pred) const |
Find attribute using predicate. | |
template<typename Predicate> | |
xml_node | find_child (Predicate pred) const |
Find child node using predicate. | |
template<typename Predicate> | |
xml_node | find_node (Predicate pred) const |
Find node from subtree using predicate. | |
xml_node | find_child_by_attribute (const char_t *name, const char_t *attr_name, const char_t *attr_value) const |
Find child node with the specified name that has specified attribute. | |
PUGIXML_DEPRECATED xml_node | find_child_by_attribute_w (const char_t *name, const char_t *attr_name, const char_t *attr_value) const |
Find child node with the specified name that has specified attribute (use pattern matching for node name and attribute name/value). | |
xml_node | find_child_by_attribute (const char_t *attr_name, const char_t *attr_value) const |
Find child node that has specified attribute. | |
PUGIXML_DEPRECATED xml_node | find_child_by_attribute_w (const char_t *attr_name, const char_t *attr_value) const |
Find child node that has specified attribute (use pattern matching for attribute name/value). | |
string_t | path (char_t delimiter= '/') const |
Get the absolute node path from root as a text string. | |
xml_node | first_element_by_path (const char_t *path, char_t delimiter= '/') const |
Search for a node by path. | |
bool | traverse (xml_tree_walker &walker) |
Recursively traverse subtree with xml_tree_walker. | |
xpath_node | select_single_node (const char_t *query) const |
Select single node by evaluating XPath query. | |
xpath_node | select_single_node (const xpath_query &query) const |
Select single node by evaluating XPath query. | |
xpath_node_set | select_nodes (const char_t *query) const |
Select node set by evaluating XPath query. | |
xpath_node_set | select_nodes (const xpath_query &query) const |
Select node set by evaluating XPath query. | |
PUGIXML_DEPRECATED unsigned int | document_order () const |
void | print (xml_writer &writer, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, encoding_t encoding=encoding_auto, unsigned int depth=0) const |
Print subtree to writer. | |
void | print (std::basic_ostream< char, std::char_traits< char > > &os, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, encoding_t encoding=encoding_auto, unsigned int depth=0) const |
Print subtree to stream. | |
void | print (std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &os, const char_t *indent=PUGIXML_TEXT("\t"), unsigned int flags=format_default, unsigned int depth=0) const |
Print subtree to stream. | |
ptrdiff_t | offset_debug () const |
Get node offset in parsed file/string (in bytes) for debugging purposes. | |
Protected Types | |
typedef xml_node_struct *xml_node::* | unspecified_bool_type |
Protected Member Functions | |
xml_node (xml_node_struct *p) | |
Protected Attributes | |
xml_node_struct * | _root |
Friends | |
class | xml_node_iterator |
|
Node iterator type (for child nodes).
|
|
Node iterator type (for child nodes).
|
|
Default ctor. Constructs an empty node. |
|
Safe bool conversion. Allows xml_node to be used in a context where boolean variable is expected, such as 'if (node)'. |
|
Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
|
|
Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
|
|
Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
|
|
Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
|
|
Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
|
|
Compare wrapped pointer to the attribute to the pointer that is wrapped by r.
|
|
Access the begin iterator for this node's collection of child nodes.
|
|
Access the end iterator for this node's collection of child nodes.
|
|
Access the begin iterator for this node's collection of attributes.
|
|
Access the end iterator for this node's collection of attributes.
|
|
Check if node is empty.
|
|
Get node type.
|
|
Get node name (element name for element nodes, PI target for PI).
|
|
Get node value (comment/PI/PCDATA/CDATA contents, depending on node type).
|
|
Get child with the specified name.
|
|
Get child with the name that matches specified pattern.
|
|
Get attribute with the specified name.
|
|
Get attribute with the name that matches specified pattern.
|
|
Get first of following sibling nodes with the specified name.
|
|
Get first of the following sibling nodes with the name that matches specified pattern.
|
|
Get following sibling.
|
|
Get first of preceding sibling nodes with the specified name.
|
|
Get first of the preceding sibling nodes with the name that matches specified pattern.
|
|
Get preceding sibling.
|
|
Get parent node.
|
|
Get root of DOM tree this node belongs to.
|
|
Get child value of current node; that is, value of the first child node of type PCDATA/CDATA.
|
|
Get child value of child with specified name.
|
|
Get child value of child with name that matches the specified pattern.
|
|
Set node name to rhs (for PI/element nodes).
|
|
Set node value to rhs (for PI/PCDATA/CDATA/comment nodes).
|
|
Add attribute with specified name (for element nodes).
|
|
Insert attribute with specified name after attr (for element nodes).
|
|
Insert attribute with specified name before attr (for element nodes).
|
|
Add a copy of the specified attribute (for element nodes).
|
|
Insert a copy of the specified attribute after attr (for element nodes).
|
|
Insert a copy of the specified attribute before attr (for element nodes).
|
|
Add child node with specified type (for element nodes).
|
|
Insert child node with specified type after node (for element nodes).
|
|
Insert child node with specified type before node (for element nodes).
|
|
Add a copy of the specified node as a child (for element nodes).
|
|
Insert a copy of the specified node after node (for element nodes).
|
|
Insert a copy of the specified node before node (for element nodes).
|
|
Remove specified attribute.
|
|
Remove attribute with the specified name, if any.
|
|
Remove specified child.
|
|
Remove child with the specified name, if any.
|
|
Get first attribute.
|
|
Get last attribute.
|
|
Get all elements from subtree with given name.
|
|
Get all elements from subtree with name that matches given pattern.
|
|
Get first child.
|
|
Get last child.
|
|
Find attribute using predicate.
|
|
Find child node using predicate.
|
|
Find node from subtree using predicate.
|
|
Find child node with the specified name that has specified attribute.
|
|
Find child node with the specified name that has specified attribute (use pattern matching for node name and attribute name/value).
|
|
Find child node that has specified attribute.
|
|
Find child node that has specified attribute (use pattern matching for attribute name/value).
|
|
Get the absolute node path from root as a text string.
|
|
Search for a node by path.
|
|
Recursively traverse subtree with xml_tree_walker.
|
|
Select single node by evaluating XPath query.
|
|
Select single node by evaluating XPath query.
|
|
Select node set by evaluating XPath query.
|
|
Select node set by evaluating XPath query.
|
|
Print subtree to writer.
|
|
Print subtree to stream.
|
|
Print subtree to stream.
|
|
Get node offset in parsed file/string (in bytes) for debugging purposes.
|