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;
123 explicit cdata(
const char *
text) : t(text) {}
149 explicit pi (
const char *name,
const char *content = NULL)
150 : n(name), c(content) {}
163 explicit text (
const char *
text) : t(text) {}
177 explicit node(
const char *name);
188 node(
const char *name,
const char *content);
229 explicit node(
pi pi_info);
269 void set_name(
const char *name);
279 const char* get_name()
const;
297 void set_content(
const char *content);
315 void set_text_content(
const char *content);
328 const char* get_content()
const;
363 const char* get_namespace()
const;
371 bool is_text()
const;
378 void push_back(
const node& child);
385 void swap(
node& other);
398 typedef int difference_type;
401 typedef std::forward_iterator_tag iterator_category;
418 impl::nipimpl *pimpl_;
421 void* get_raw_node()
const;
427 friend bool XMLWRAPP_API operator==(
const iterator& lhs,
const iterator& rhs);
439 typedef int difference_type;
442 typedef std::forward_iterator_tag iterator_category;
460 impl::nipimpl *pimpl_;
463 void* get_raw_node()
const;
531 const_iterator
self()
const;
551 const_iterator parent()
const;
568 iterator find(
const char *name);
586 const_iterator find(
const char *name)
const;
605 iterator find(
const char *name,
const iterator& start);
624 const_iterator find(
const char *name,
const const_iterator& start)
const;
716 iterator insert(
const node& n);
726 iterator insert(
const iterator& position,
const node& n);
739 iterator replace(
const iterator& old_node,
const node& new_node);
750 iterator erase(
const iterator& to_erase);
761 iterator erase(iterator first,
const iterator& last);
772 size_type erase(
const char *name);
792 void sort(
const char *node_name,
const char *attr_name);
801 template <
typename T>
void sort (T compare)
802 { impl::sort_callback<T> cb(compare); sort_fo(cb); }
810 void node_to_string(std::string& xml)
const;
819 friend XMLWRAPP_API std::ostream& operator<< (std::ostream &stream,
const node &n);
822 impl::node_impl *pimpl_;
827 void set_node_data(
void *data);
828 void* get_node_data();
829 void* release_node_data();
831 void sort_fo(impl::cbfo_node_compare &fo);
834 friend class impl::node_iterator;
836 friend struct impl::doc_impl;
837 friend struct impl::node_cmp;
842 inline bool XMLWRAPP_API operator==(
const node::iterator& lhs,
843 const node::iterator& rhs)
844 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
845 inline bool XMLWRAPP_API operator!=(
const node::iterator& lhs,
846 const node::iterator& rhs)
847 {
return !(lhs == rhs); }
849 inline bool XMLWRAPP_API operator==(
const node::const_iterator& lhs,
850 const node::const_iterator& rhs)
851 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
852 inline bool XMLWRAPP_API operator!=(
const node::const_iterator& lhs,
853 const node::const_iterator& rhs)
854 {
return !(lhs == rhs); }
858 #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 "<chapter/>".
Definition: node.h:95
Helper struct for creating a xml::node of type_pi.
Definition: node.h:147
This file contains the definition of the xml::init class.
<![CDATA[text]]>
Definition: node.h:97
Helper struct for creating a xml::node of type_cdata.
Definition: node.h:121
DOCTYPE node.
Definition: node.h:104
Entity as in &amp;.
Definition: node.h:100
Document node.
Definition: node.h:103
node_type
enum for the different types of XML nodes
Definition: node.h:93
This class implements a read-only view of XML nodes.
Definition: nodes_view.h:219
The xml::document class is used to hold the XML tree and various bits of information about it...
Definition: document.h:82
XML comment.
Definition: node.h:99
The xml::node::iterator provides a way to access children nodes similar to a standard C++ container...
Definition: node.h:394
Notation.
Definition: node.h:106
Processing Instruction.
Definition: node.h:98
DTD <!ELEMENT> node.
Definition: node.h:108
const_iterator end() const
Get a const_iterator that points one past the last child for this node.
Definition: node.h:517
The xml::node class is used to hold information about one XML node.
Definition: node.h:86
The xml::attributes class is used to access all the attributes of one xml::node.
Definition: attributes.h:71
DTD node.
Definition: node.h:107
iterator end()
Get an iterator that points one past the last child for this node.
Definition: node.h:509
<xi:include/> node
Definition: node.h:102
DTD <!ATTRLIST> node.
Definition: node.h:109
std::size_t size_type
size type
Definition: node.h:90
Entity ref.
Definition: node.h:101
The xml::node::const_iterator provides a way to access children nodes similar to a standard C++ conta...
Definition: node.h:435
Document Fragment.
Definition: node.h:105
DTD <!ENTITY>
Definition: node.h:110
This class implements a view of XML nodes.
Definition: nodes_view.h:77
Helper struct for creating a xml::node of type_text.
Definition: node.h:161
Text node.
Definition: node.h:96
void sort(T compare)
Sort all the children nodes of this node using the given comparison function object.
Definition: node.h:801