xml_node Class Reference

#include <pugixml.hpp>

Class Description

Definition at line 358 of file pugixml.hpp.

+ Inheritance diagram for xml_node:

Public Types

typedef xml_node_iterator iterator
 
typedef xml_attribute_iterator attribute_iterator
 

Public Member Functions

 xml_node ()
 
 xml_node (xml_node_struct *p)
 
 operator unspecified_bool_type () const
 
bool operator! () const
 
bool operator== (const xml_node &r) const
 
bool operator!= (const xml_node &r) const
 
bool operator< (const xml_node &r) const
 
bool operator> (const xml_node &r) const
 
bool operator<= (const xml_node &r) const
 
bool operator>= (const xml_node &r) const
 
bool empty () const
 
xml_node_type type () const
 
const char_tname () const
 
const char_tvalue () const
 
xml_attribute first_attribute () const
 
xml_attribute last_attribute () const
 
xml_node first_child () const
 
xml_node last_child () const
 
xml_node next_sibling () const
 
xml_node previous_sibling () const
 
xml_node parent () const
 
xml_node root () const
 
xml_text text () const
 
xml_node child (const char_t *name) const
 
xml_attribute attribute (const char_t *name) const
 
xml_node next_sibling (const char_t *name) const
 
xml_node previous_sibling (const char_t *name) const
 
const char_tchild_value () const
 
const char_tchild_value (const char_t *name) const
 
bool set_name (const char_t *rhs)
 
bool set_value (const char_t *rhs)
 
xml_attribute append_attribute (const char_t *name)
 
xml_attribute prepend_attribute (const char_t *name)
 
xml_attribute insert_attribute_after (const char_t *name, const xml_attribute &attr)
 
xml_attribute insert_attribute_before (const char_t *name, const xml_attribute &attr)
 
xml_attribute append_copy (const xml_attribute &proto)
 
xml_attribute prepend_copy (const xml_attribute &proto)
 
xml_attribute insert_copy_after (const xml_attribute &proto, const xml_attribute &attr)
 
xml_attribute insert_copy_before (const xml_attribute &proto, const xml_attribute &attr)
 
xml_node append_child (xml_node_type type=node_element)
 
xml_node prepend_child (xml_node_type type=node_element)
 
xml_node insert_child_after (xml_node_type type, const xml_node &node)
 
xml_node insert_child_before (xml_node_type type, const xml_node &node)
 
xml_node append_child (const char_t *name)
 
xml_node prepend_child (const char_t *name)
 
xml_node insert_child_after (const char_t *name, const xml_node &node)
 
xml_node insert_child_before (const char_t *name, const xml_node &node)
 
xml_node append_copy (const xml_node &proto)
 
xml_node prepend_copy (const xml_node &proto)
 
xml_node insert_copy_after (const xml_node &proto, const xml_node &node)
 
xml_node insert_copy_before (const xml_node &proto, const xml_node &node)
 
bool remove_attribute (const xml_attribute &a)
 
bool remove_attribute (const char_t *name)
 
bool remove_child (const xml_node &n)
 
bool remove_child (const char_t *name)
 
template<typename Predicate >
xml_attribute find_attribute (Predicate pred) const
 
template<typename Predicate >
xml_node find_child (Predicate pred) const
 
template<typename Predicate >
xml_node find_node (Predicate pred) const
 
xml_node find_child_by_attribute (const char_t *name, const char_t *attr_name, const char_t *attr_value) const
 
xml_node find_child_by_attribute (const char_t *attr_name, const char_t *attr_value) const
 
string_t path (char_t delimiter= '/') const
 
xml_node first_element_by_path (const char_t *path, char_t delimiter= '/') const
 
bool traverse (xml_tree_walker &walker)
 
xpath_node select_single_node (const char_t *query, xpath_variable_set *variables=0) const
 
xpath_node select_single_node (const xpath_query &query) const
 
xpath_node_set select_nodes (const char_t *query, xpath_variable_set *variables=0) const
 
xpath_node_set select_nodes (const xpath_query &query) const
 
void print (xml_writer &writer, const char_t *indent="\t", unsigned int flags=format_default, xml_encoding encoding=encoding_auto, unsigned int depth=0) const
 
void print (std::basic_ostream< char, std::char_traits< char > > &os, const char_t *indent="\t", unsigned int flags=format_default, xml_encoding encoding=encoding_auto, unsigned int depth=0) const
 
void print (std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &os, const char_t *indent="\t", unsigned int flags=format_default, unsigned int depth=0) const
 
iterator begin () const
 
iterator end () const
 
attribute_iterator attributes_begin () const
 
attribute_iterator attributes_end () const
 
xml_object_range< xml_node_iteratorchildren () const
 
xml_object_range< xml_named_node_iteratorchildren (const char_t *name) const
 
xml_object_range< xml_attribute_iteratorattributes () const
 
ptrdiff_t offset_debug () const
 
size_t hash_value () const
 
xml_node_struct * internal_object () const
 

Protected Types

typedef void(* unspecified_bool_type) (xml_node ***)
 

Protected Attributes

xml_node_struct * _root
 

Friends

class xml_attribute_iterator
 
class xml_node_iterator
 
class xml_named_node_iterator
 

Member Typedef Documentation

Definition at line 564 of file pugixml.hpp.

Definition at line 558 of file pugixml.hpp.

typedef void(* unspecified_bool_type) (xml_node ***)
protected

Definition at line 367 of file pugixml.hpp.

Constructor & Destructor Documentation

xml_node ( )
xml_node ( xml_node_struct *  p)
explicit

Member Function Documentation

xml_attribute append_attribute ( const char_t name)
xml_node append_child ( xml_node_type  type = node_element)
xml_node append_child ( const char_t name)
xml_attribute append_copy ( const xml_attribute proto)
xml_node append_copy ( const xml_node proto)
xml_attribute attribute ( const char_t name) const
attribute_iterator attributes_begin ( ) const
attribute_iterator attributes_end ( ) const
iterator begin ( ) const
xml_node child ( const char_t name) const
const char_t* child_value ( ) const
const char_t* child_value ( const char_t name) const
xml_object_range<xml_node_iterator> children ( ) const
xml_object_range<xml_named_node_iterator> children ( const char_t name) const
bool empty ( ) const
iterator end ( ) const
xml_attribute find_attribute ( Predicate  pred) const
inline

Definition at line 476 of file pugixml.hpp.

477  {
478  if (!_root) return xml_attribute();
479 
480  for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
481  if (pred(attrib))
482  return attrib;
483 
484  return xml_attribute();
485  }
xml_attribute first_attribute() const
xml_node_struct * _root
Definition: pugixml.hpp:365
xml_attribute next_attribute() const
xml_node find_child ( Predicate  pred) const
inline

Definition at line 488 of file pugixml.hpp.

489  {
490  if (!_root) return xml_node();
491 
492  for (xml_node node = first_child(); node; node = node.next_sibling())
493  if (pred(node))
494  return node;
495 
496  return xml_node();
497  }
xml_node first_child() const
Definition: node.h:10
xml_node_struct * _root
Definition: pugixml.hpp:365
struct _node node
xml_node find_child_by_attribute ( const char_t name,
const char_t attr_name,
const char_t attr_value 
) const
xml_node find_child_by_attribute ( const char_t attr_name,
const char_t attr_value 
) const
xml_node find_node ( Predicate  pred) const
inline

Definition at line 500 of file pugixml.hpp.

501  {
502  if (!_root) return xml_node();
503 
504  xml_node cur = first_child();
505 
506  while (cur._root && cur._root != _root)
507  {
508  if (pred(cur)) return cur;
509 
510  if (cur.first_child()) cur = cur.first_child();
511  else if (cur.next_sibling()) cur = cur.next_sibling();
512  else
513  {
514  while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
515 
516  if (cur._root != _root) cur = cur.next_sibling();
517  }
518  }
519 
520  return xml_node();
521  }
xml_node first_child() const
xml_node_struct * _root
Definition: pugixml.hpp:365
xml_attribute first_attribute ( ) const
xml_node first_child ( ) const
xml_node first_element_by_path ( const char_t path,
char_t  delimiter = '/' 
) const
size_t hash_value ( ) const
xml_attribute insert_attribute_after ( const char_t name,
const xml_attribute attr 
)
xml_attribute insert_attribute_before ( const char_t name,
const xml_attribute attr 
)
xml_node insert_child_after ( xml_node_type  type,
const xml_node node 
)
xml_node insert_child_after ( const char_t name,
const xml_node node 
)
xml_node insert_child_before ( xml_node_type  type,
const xml_node node 
)
xml_node insert_child_before ( const char_t name,
const xml_node node 
)
xml_attribute insert_copy_after ( const xml_attribute proto,
const xml_attribute attr 
)
xml_node insert_copy_after ( const xml_node proto,
const xml_node node 
)
xml_attribute insert_copy_before ( const xml_attribute proto,
const xml_attribute attr 
)
xml_node insert_copy_before ( const xml_node proto,
const xml_node node 
)
xml_node_struct* internal_object ( ) const
xml_attribute last_attribute ( ) const
xml_node last_child ( ) const
const char_t* name ( ) const
xml_node next_sibling ( ) const
xml_node next_sibling ( const char_t name) const
ptrdiff_t offset_debug ( ) const
operator unspecified_bool_type ( ) const
bool operator! ( ) const
bool operator!= ( const xml_node r) const
bool operator< ( const xml_node r) const
bool operator<= ( const xml_node r) const
bool operator== ( const xml_node r) const
bool operator> ( const xml_node r) const
bool operator>= ( const xml_node r) const
xml_node parent ( ) const
string_t path ( char_t  delimiter = '/') const
xml_attribute prepend_attribute ( const char_t name)
xml_node prepend_child ( xml_node_type  type = node_element)
xml_node prepend_child ( const char_t name)
xml_attribute prepend_copy ( const xml_attribute proto)
xml_node prepend_copy ( const xml_node proto)
xml_node previous_sibling ( ) const
xml_node previous_sibling ( const char_t name) const
void print ( xml_writer writer,
const char_t indent = "\t",
unsigned int  flags = format_default,
xml_encoding  encoding = encoding_auto,
unsigned int  depth = 0 
) const
void print ( std::basic_ostream< char, std::char_traits< char > > &  os,
const char_t indent = "\t",
unsigned int  flags = format_default,
xml_encoding  encoding = encoding_auto,
unsigned int  depth = 0 
) const
void print ( std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &  os,
const char_t indent = "\t",
unsigned int  flags = format_default,
unsigned int  depth = 0 
) const
bool remove_attribute ( const xml_attribute a)
bool remove_attribute ( const char_t name)
bool remove_child ( const xml_node n)
bool remove_child ( const char_t name)
xml_node root ( ) const
xpath_node_set select_nodes ( const char_t query,
xpath_variable_set variables = 0 
) const
xpath_node_set select_nodes ( const xpath_query query) const
xpath_node select_single_node ( const char_t query,
xpath_variable_set variables = 0 
) const
xpath_node select_single_node ( const xpath_query query) const
bool set_name ( const char_t rhs)
bool set_value ( const char_t rhs)
bool traverse ( xml_tree_walker walker)
xml_node_type type ( ) const
const char_t* value ( ) const

Friends And Related Function Documentation

friend class xml_attribute_iterator
friend

Definition at line 360 of file pugixml.hpp.

friend class xml_named_node_iterator
friend

Definition at line 362 of file pugixml.hpp.

friend class xml_node_iterator
friend

Definition at line 361 of file pugixml.hpp.

Member Data Documentation

xml_node_struct* _root
protected

Definition at line 365 of file pugixml.hpp.


The documentation for this class was generated from the following file: