libzeep

PrevUpHomeNext

Class element

zeep::xml::element — the element class modelling a XML element

Synopsis

// 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 *);
};

Description

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 construct/copy/destruct

  1. ();
  2. ( qname);
  3. ( qname, 
            attribute > attributes);
    constructor taking a qname and a list of attributes
  4. (element & e);
  5. (element && e);
  6. element & (element & e);
  7. element & (element && e);
  8. ~();

element friend functions

  1.  ( os, element & e);
    write the element to os

element public member functions

  1.  () ;

    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.

  2.  ( qn);
  3.  () ;
    content of a xml:lang attribute of this element, or its nearest ancestor
  4.  () ;

    content of the xml:id attribute, or the attribute that was defined to be of type ID by the DOCTYPE.

  5.  (element & e) ;
  6.  (element & e) ;
  7.  (node * n) ;
    Compare the node with n.
  8.  (element & e) ;
  9. node_list & ();
  10. node_list & () ;
  11. iterator ();
  12. iterator ();
  13. const_iterator () ;
  14. const_iterator () ;
  15. const_iterator ();
  16. const_iterator ();
  17. element & ();
  18. element & () ;
  19. element & ();
  20. element & () ;
  21.  (const_iterator pos, element & e);
    insert a copy of e
  22.  (const_iterator pos, element && e);
    insert a copy of e at position pos, moving its data
  23. template<typename InputIter> 
      iterator (const_iterator pos,  first,  last);
    insert copies of the nodes from first to last at position pos
  24. iterator (const_iterator pos, element > nodes);
    insert copies of the nodes in nodes at position pos
  25. iterator (const_iterator pos, text && n);
    insert the data of node n at position pos, using move semantics
  26. iterator (const_iterator pos, cdata && n);
    insert the data of node n at position pos, using move semantics
  27. iterator (const_iterator pos, comment && n);
    insert the data of node n at position pos, using move semantics
  28. iterator (const_iterator pos, processing_instruction && n);
    insert the data of node n at position pos, using move semantics
  29. template<typename Arg> iterator (const_iterator pos,  arg);
    emplace a newly constructed element at pos using argument arg
  30. template< Args> 
      iterator (const_iterator pos,  args);
    emplace a newly constructed element at pos using arguments args
  31. iterator (const_iterator pos,  name, 
                     attribute > attrs);
    emplace a newly constructed element at pos using name name and attributes attrs
  32. template< Args> element & ( args);
    emplace an element at the front using arguments args
  33. element & ( name, 
                            attribute > attrs);
    emplace a newly constructed element at the front using name name and attributes attrs
  34. template< Args> element & ( args);
    emplace an element at the back using arguments args
  35. element & ( name, 
                           attribute > attrs);
    emplace a newly constructed element at the back using name name and attributes attrs
  36. iterator ( pos);
    erase the node at pos
  37. iterator (iterator first, iterator last);
    erase the nodes from first to last
  38.  ();
    erase the first node
  39.  ();
    erase the last node
  40.  (element && e);
    move the element e to the front of this element.
  41.  (element & e);
    copy the element e to the front of this element.
  42.  (element && e);
    move the element e to the back of this element.
  43.  (element & e);
    copy the element e to the back of this element.
  44.  ();
    remove all nodes
  45.  () ;
  46.  () ;
  47. attribute_set & ();
    return the set of attributes for this element
  48. attribute_set & () ;
    return the set of attributes for this element
  49.  () ;
    will return the concatenation of str() from all child nodes
  50.  ( prefix) ;
    return the URI of the namespace for prefix
  51.  
    ( 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.

  52.  ( prefix,  uri, 
                             recursive,  including_attributes);
    move this element and optionally everyting beneath it to the specified namespace/prefix

    Parameters:

    including_attributes

    Move the attributes to this new namespace as well

    prefix

    The new prefix name

    recursive

    Apply this to the child nodes as well

    uri

    The new namespace uri

  53.  () ;
    return the concatenation of the content of all enclosed zeep::xml::text nodes
  54.  ( content);
    replace all existing child text nodes with a new single text node containing content
  55.  ( qname) ;
    return the value of attribute name qname or the empty string if not found
  56.  ( qname,  value);
    set the value of attribute named qname to the value value
  57.  ( s);
    The set_text method replaces any text node with the new text (call set_content)
  58.  ( 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.

  59.  ();
    To combine all adjecent child text nodes into one.
  60.  ( 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.

  61. 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.

  62.  ( 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.

  63. 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.

  64.  ();
    debug routine
  65.  ();
  66.  ( 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:

    name

    The actual name to use

    prefix

    The namespace prefix to use

element protected member functions

  1. node * () ;
    return an exact copy of this node, including all data in sub nodes
  2. 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.

  3.  ( os, format_info fmt) ;
    low level routine for writing out XML

    This method is usually called by operator<<(std::ostream&, zeep::xml::document&)

  4.  (const_iterator pos, node * n);

PrevUpHomeNext