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 *content) : t(content) {}
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);
438 typedef int difference_type;
441 typedef std::forward_iterator_tag iterator_category;
448 reference operator* ()
const;
449 pointer operator->()
const;
458 impl::nipimpl *pimpl_;
461 void* get_raw_node()
const;
467 friend bool XMLWRAPP_API operator==(
const iterator& lhs,
const iterator& rhs);
481 typedef int difference_type;
484 typedef std::forward_iterator_tag iterator_category;
492 reference operator* ()
const;
493 pointer operator->()
const;
502 impl::nipimpl *pimpl_;
505 void* get_raw_node()
const;
520 size_type size()
const;
814 size_type erase(
const char *name);
834 void sort(
const char *node_name,
const char *attr_name);
843 template <
typename T>
void sort (T compare)
844 { impl::sort_callback<T> cb(compare); sort_fo(cb); }
852 std::string node_to_string()
const;
861 { xml = node_to_string(); }
870 friend XMLWRAPP_API std::ostream& operator<< (std::ostream &stream,
const node &n);
873 impl::node_impl *pimpl_;
878 void set_node_data(
void *data);
879 void* get_node_data();
880 void* release_node_data();
882 void sort_fo(impl::cbfo_node_compare &fo);
885 friend class impl::node_iterator;
887 friend struct impl::doc_impl;
888 friend struct impl::node_cmp;
890 friend struct impl::xpath_context_impl;
897 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
900 {
return !(lhs == rhs); }
904 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
907 {
return !(lhs == rhs); }
911 #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: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.
<![CDATA[text]]>
Definition: node.h:99
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
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:84
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:434
Notation.
Definition: node.h:108
XML library namespace.
Definition: attributes.h:51
Processing Instruction.
Definition: node.h:100
DTD <!ELEMENT> node.
Definition: node.h:110
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:551
<xi:include/> node
Definition: node.h:104
DTD <!ATTRLIST> 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:477
Document Fragment.
Definition: node.h:107
DTD <!ENTITY>
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
const_iterator end() const
Get a const_iterator that points one past the last child for this node.
Definition: node.h:559
void sort(T compare)
Sort all the children nodes of this node using the given comparison function object.
Definition: node.h:843
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:860