40 #ifndef _xmlwrapp_node_h_
41 #define _xmlwrapp_node_h_
45 #include "xmlwrapp/export.h"
48 #include "xmlwrapp/_cbfo.h"
62 class const_nodes_view;
67 class iter_advance_functor;
72 struct xpath_context_impl;
125 explicit cdata(
const char *
text) : t(text) {}
151 explicit pi (
const char *name,
const char *content = NULL)
152 : n(name), c(content) {}
165 explicit text (
const char *
text) : t(text) {}
179 explicit node(
const char *name);
190 node(
const char *name,
const char *content);
231 explicit node(
pi pi_info);
271 void set_name(
const char *name);
281 const char* get_name()
const;
299 void set_content(
const char *content);
317 void set_text_content(
const char *content);
330 const char* get_content()
const;
365 const char* get_namespace()
const;
382 void set_namespace(
const std::string& href);
390 bool is_text()
const;
397 void push_back(
const node& child);
404 void swap(
node& other);
422 void move_under(
node& new_parent);
436 typedef int difference_type;
439 typedef std::forward_iterator_tag iterator_category;
446 reference operator* ()
const;
447 pointer operator->()
const;
456 impl::nipimpl *pimpl_;
459 void* get_raw_node()
const;
465 friend bool XMLWRAPP_API operator==(
const iterator& lhs,
const iterator& rhs);
477 typedef int difference_type;
480 typedef std::forward_iterator_tag iterator_category;
488 reference operator* ()
const;
489 pointer operator->()
const;
498 impl::nipimpl *pimpl_;
501 void* get_raw_node()
const;
516 size_type size()
const;
569 const_iterator
self()
const;
589 const_iterator parent()
const;
606 iterator find(
const char *name);
624 const_iterator find(
const char *name)
const;
643 iterator find(
const char *name,
const iterator& start);
662 const_iterator find(
const char *name,
const const_iterator& start)
const;
754 iterator insert(
const node& n);
764 iterator insert(
const iterator& position,
const node& n);
777 iterator replace(
const iterator& old_node,
const node& new_node);
788 iterator erase(
const iterator& to_erase);
799 iterator erase(iterator first,
const iterator& last);
810 size_type erase(
const char *name);
830 void sort(
const char *node_name,
const char *attr_name);
839 template <
typename T>
void sort (T compare)
840 { impl::sort_callback<T> cb(compare); sort_fo(cb); }
848 std::string node_to_string()
const;
857 { xml = node_to_string(); }
866 friend XMLWRAPP_API std::ostream& operator<< (std::ostream &stream,
const node &n);
869 impl::node_impl *pimpl_;
874 void set_node_data(
void *data);
875 void* get_node_data();
876 void* release_node_data();
878 void sort_fo(impl::cbfo_node_compare &fo);
881 friend class impl::node_iterator;
883 friend struct impl::doc_impl;
884 friend struct impl::node_cmp;
886 friend struct impl::xpath_context_impl;
891 inline bool XMLWRAPP_API operator==(
const node::iterator& lhs,
892 const node::iterator& rhs)
893 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
894 inline bool XMLWRAPP_API operator!=(
const node::iterator& lhs,
895 const node::iterator& rhs)
896 {
return !(lhs == rhs); }
898 inline bool XMLWRAPP_API operator==(
const node::const_iterator& lhs,
899 const node::const_iterator& rhs)
900 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
901 inline bool XMLWRAPP_API operator!=(
const node::const_iterator& lhs,
902 const node::const_iterator& rhs)
903 {
return !(lhs == rhs); }
907 #endif // _xmlwrapp_node_h_
The xml::tree_parser class is used to parse an XML document and generate a tree like structure of xml...
Definition: tree_parser.h:73
XML element such as "".
Definition: node.h:97
Helper struct for creating a xml::node of type_pi.
Definition: node.h:149
This file contains the definition of the xml::init class.
Helper struct for creating a xml::node of type_cdata.
Definition: node.h:123
DOCTYPE node.
Definition: node.h:106
Entity as in &.
Definition: node.h:102
Document node.
Definition: node.h:105
node_type
enum for the different types of XML nodes
Definition: node.h:95
void node_to_string(std::string &xml) const
Convert the node and all its children into XML text and set the given string to that text...
Definition: node.h:856
This class implements a read-only view of XML nodes.
Definition: nodes_view.h:252
The xml::document class is used to hold the XML tree and various bits of information about it...
Definition: document.h:83
XML comment.
Definition: node.h:101
The xml::node::iterator provides a way to access children nodes similar to a standard C++ container...
Definition: node.h:432
Notation.
Definition: node.h:108
XML library namespace.
Definition: attributes.h:51
Processing Instruction.
Definition: node.h:100
DTD node.
Definition: node.h:110
const_iterator end() const
Get a const_iterator that points one past the last child for this node.
Definition: node.h:555
The xml::node class is used to hold information about one XML node.
Definition: node.h:88
The xml::attributes class is used to access all the attributes of one xml::node.
Definition: attributes.h:71
DTD node.
Definition: node.h:109
iterator end()
Get an iterator that points one past the last child for this node.
Definition: node.h:547
node
Definition: node.h:104
DTD node.
Definition: node.h:111
std::size_t size_type
size type
Definition: node.h:92
Entity ref.
Definition: node.h:103
The xml::node::const_iterator provides a way to access children nodes similar to a standard C++ conta...
Definition: node.h:473
Document Fragment.
Definition: node.h:107
DTD
Definition: node.h:112
This class implements a view of XML nodes.
Definition: nodes_view.h:78
Helper struct for creating a xml::node of type_text.
Definition: node.h:163
Text node.
Definition: node.h:98
void sort(T compare)
Sort all the children nodes of this node using the given comparison function object.
Definition: node.h:839