zeep::xml::element
// In header: </home/maarten/projects/libzeep/zeep/xml/node.hpp> class element : public zeep::xml::container { public: // member classes/structs/unions // as a service to the user, we define an attribute iterator here class attribute_iterator { public: // construct/copy/destruct attribute_iterator(); attribute_iterator(attribute *); attribute_iterator(const attribute_iterator &); attribute_iterator& operator=(const attribute_iterator &); // public member functions reference operator*() const; pointer operator->() const; attribute_iterator & operator++(); attribute_iterator operator++(int); attribute_iterator & operator--(); attribute_iterator operator--(int); bool operator==(const attribute_iterator &) const; bool operator!=(const attribute_iterator &) const; pointer base() const; }; class const_attribute_iterator { public: // construct/copy/destruct const_attribute_iterator(); const_attribute_iterator(attribute *); const_attribute_iterator(const attribute_iterator &); const_attribute_iterator(const const_attribute_iterator &); const_attribute_iterator& operator=(const const_attribute_iterator &); // public member functions reference operator*() const; pointer operator->() const; const_attribute_iterator & operator++(); const_attribute_iterator operator++(int); const_attribute_iterator & operator--(); const_attribute_iterator operator--(int); bool operator==(const const_attribute_iterator &) const; bool operator!=(const const_attribute_iterator &) const; pointer base() const; }; // construct/copy/destruct element(const std::string &); ~element(); // public member functions void write(writer &) const; bool equals(const node *) const; node * clone() const; std::string str() const; void write_content(std::ostream &, const char * = kWhiteSpaceChar) const; std::string qname() const; std::string namespace_for_prefix(const std::string &) const; std::string prefix_for_namespace(const std::string &) const; std::string content() const; void content(const std::string &); std::string get_attribute(const std::string &) const; attribute * get_attribute_node(const std::string &) const; void set_attribute(const std::string &, const std::string &, bool = false); void remove_attribute(const std::string &); void set_name_space(const std::string &, const std::string &); void add_text(const std::string &); attribute_set attributes() const; name_space_list name_spaces() const; std::string lang() const; std::string id() const; attribute_iterator attr_begin(); attribute_iterator attr_end(); const_attribute_iterator attr_begin() const; const_attribute_iterator attr_end() const; };
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 functionsvoid write(writer & w) const;writing out
bool equals(const node * n) const;Compare the node with n.
node * clone() const;Deep clone the node.
std::string str() const;return all content concatenated, including that of children.
void write_content(std::ostream & os, const char * sep = kWhiteSpaceChar) const;write out the concatenated content to a stream, separated by sep.
std::string qname() const;
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.
std::string namespace_for_prefix(const std::string & prefix) const;Return the namespace URI for a prefix.
std::string prefix_for_namespace(const std::string & uri) const;Return the prefix for a namespace URI.
std::string content() const;
void content(const std::string & content);
std::string get_attribute(const std::string & qname) const;
attribute * get_attribute_node(const std::string & qname) const;
void set_attribute(const std::string & qname, const std::string & value, bool id = false);the DOCTYPE can specify some attributes as ID
void remove_attribute(const std::string & qname);
void set_name_space(const std::string & prefix, const std::string & uri);to set the default namespace, pass an empty string as prefix
void add_text(const std::string & 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.
attribute_set attributes() const;to iterate over the attribute nodes
name_space_list name_spaces() const;to iterate over the namespace nodes
std::string lang() const;content of a xml:lang attribute of this element, or its nearest ancestor
std::string id() const;
content of the xml:id attribute, or the attribute that was defined to be of type ID by the DOCTYPE.
attribute_iterator attr_begin();
attribute_iterator attr_end();
const_attribute_iterator attr_begin() const;
const_attribute_iterator attr_end() const;