![]() |
zeep::xml::element — the element class modelling a XML element
// In header: <zeep/xml/node.hpp> class element : public { public: // types typedef element ; typedef element > ; typedef ; typedef ; typedef element & ; typedef element & ; typedef element * ; typedef element * ; typedef iterator_impl< element, node > ; typedef iterator_impl< element, node > ; typedef ; typedef ; // construct/copy/destruct (); (); (, attribute >); (element &); (element &&); element & (element &); element & (element &&); ~(); // friend functions (, element &); // public member functions () ; (); () ; () ; (element &) ; (element &) ; (node *) ; (element &) ; node_list & (); node_list & () ; iterator (); iterator (); const_iterator () ; const_iterator () ; const_iterator (); const_iterator (); element & (); element & () ; element & (); element & () ; (const_iterator, element &); (const_iterator, element &&); template<typename InputIter> iterator (const_iterator, , ); iterator (const_iterator, element >); iterator (const_iterator, text &&); iterator (const_iterator, cdata &&); iterator (const_iterator, comment &&); iterator (const_iterator, processing_instruction &&); template<typename Arg> iterator (const_iterator, ); template< Args> iterator (const_iterator, ); iterator (const_iterator, , attribute >); template< Args> element & (); element & (, attribute >); template< Args> element & (); element & (, attribute >); iterator (); iterator (iterator, iterator); (); (); (element &&); (element &); (element &&); (element &); (); () ; () ; attribute_set & (); attribute_set & () ; () ; () ; () ; (, , , ); () ; (); () ; (, ); (); (); (); () ; element * () ; () ; element * () ; (); (, ); // protected member functions node * () ; node * (); (, format_info) ; (const_iterator, node *); };
element is the most important zeep::xml::node object. It encapsulates a XML element as found in the XML document. It has a qname, can have children, attributes and a namespace.
element
public member functions() ;
Nodes can have a name, and the XPath specification requires that a node can have a so-called expanded-name. This name consists of a local-name and a namespace which is a URI. And we can have a QName which is a concatenation of a prefix (that points to a namespace URI) and a local-name separated by a colon.
To reduce storage requirements, names are stored in nodes as qnames, if at all.
( qn);
() ;content of a xml:lang attribute of this element, or its nearest ancestor
() ;
content of the xml:id attribute, or the attribute that was defined to be of type ID by the DOCTYPE.
(element & e) ;
(element & e) ;
(node * n) ;Compare the node with n.
(element & e) ;
node_list & ();
node_list & () ;
iterator ();
iterator ();
const_iterator () ;
const_iterator () ;
const_iterator ();
const_iterator ();
element & ();
element & () ;
element & ();
element & () ;
(const_iterator pos, element & e);insert a copy of e
(const_iterator pos, element && e);insert a copy of e at position pos, moving its data
template<typename InputIter> iterator (const_iterator pos, first, last);insert copies of the nodes from first to last at position pos
iterator (const_iterator pos, element > nodes);insert copies of the nodes in nodes at position pos
iterator (const_iterator pos, text && n);insert the data of node n at position pos, using move semantics
iterator (const_iterator pos, cdata && n);insert the data of node n at position pos, using move semantics
iterator (const_iterator pos, comment && n);insert the data of node n at position pos, using move semantics
iterator (const_iterator pos, processing_instruction && n);insert the data of node n at position pos, using move semantics
template<typename Arg> iterator (const_iterator pos, arg);emplace a newly constructed element at pos using argument arg
template< Args> iterator (const_iterator pos, args);emplace a newly constructed element at pos using arguments args
iterator (const_iterator pos, name, attribute > attrs);emplace a newly constructed element at pos using name name and attributes attrs
template< Args> element & ( args);emplace an element at the front using arguments args
element & ( name, attribute > attrs);emplace a newly constructed element at the front using name name and attributes attrs
template< Args> element & ( args);emplace an element at the back using arguments args
element & ( name, attribute > attrs);emplace a newly constructed element at the back using name name and attributes attrs
iterator ( pos);erase the node at pos
iterator (iterator first, iterator last);erase the nodes from first to last
();erase the first node
();erase the last node
(element && e);move the element e to the front of this element.
(element & e);copy the element e to the front of this element.
(element && e);move the element e to the back of this element.
(element & e);copy the element e to the back of this element.
();remove all nodes
() ;
() ;
attribute_set & ();return the set of attributes for this element
attribute_set & () ;return the set of attributes for this element
() ;will return the concatenation of str() from all child nodes
( prefix) ;return the URI of the namespace for prefix
( uri) ;return the prefix for the XML namespace with uri uri.
Returns: |
The result is a pair of a std::string containing the actual prefix value and a boolean indicating if the namespace was found at all, needed since empty prefixes are allowed. |
( prefix, uri, recursive, including_attributes);move this element and optionally everyting beneath it to the specified namespace/prefix
Parameters: |
|
() ;return the concatenation of the content of all enclosed
zeep::xml::text
nodes ( content);replace all existing child text nodes with a new single text node containing content
( qname) ;return the value of attribute name qname or the empty string if not found
( qname, value);set the value of attribute named qname to the value value
( s);The set_text method replaces any text node with the new text (call set_content)
( s);
The add_text method checks if the last added child is a text node, and if so, it appends the string to this node's value. Otherwise, it adds a new text node child with the new text.
();To combine all adjecent child text nodes into one.
( path) ;return the elements that match XPath path.
xpath wrappers TODO: create recursive iterator and use it as return type here
If you need to find other classes than xml::element
, of if your XPath contains variables, you should create a zeep::xml::xpath
object and use its evaluate method.
element * ( path) ;return the first element that matches XPath path.
If you need to find other classes than xml::element
, of if your XPath contains variables, you should create a zeep::xml::xpath
object and use its evaluate method.
( path) ;return the elements that match XPath path.
If you need to find other classes than xml::element
, of if your XPath contains variables, you should create a zeep::xml::xpath
object and use its evaluate method.
element * ( path) ;return the first element that matches XPath path.
If you need to find other classes than xml::element
, of if your XPath contains variables, you should create a zeep::xml::xpath
object and use its evaluate method.
();debug routine
( prefix, name);set the qname with two parameters, if prefix is empty the qname will be simply name otherwise the name will be
prefix:name
Parameters: |
|
element
protected member functionsnode * () ;return an exact copy of this node, including all data in sub nodes
node * ();
return a copy of this node, including all data in sub nodes, but in contrast with clone the data is moved from this node to the cloned node. This node will be empty afterwards.
( os, format_info fmt) ;low level routine for writing out XML
This method is usually called by operator<<(std::ostream&, zeep::xml::document&)
(const_iterator pos, node * n);