![]() |
zeep::xml::attribute — An attribute is a node, has an element as parent, but is not a child of this parent (!)
// In header: <zeep/xml/node.hpp> class attribute : public zeep::xml::node { public: // types typedef element parent_type; // construct/copy/destruct attribute(const attribute &); attribute(attribute &&); attribute(const std::string &, const std::string &, bool = false); attribute & operator=(attribute &&); // public member functions bool operator==(const attribute &) const; bool operator!=(const attribute &) const; bool operator<(const attribute &) const; virtual std::string get_qname() const; virtual void set_qname(const std::string &); virtual void set_qname(const std::string &, const std::string &); bool is_namespace() const; std::string value() const; void value(const std::string &); std::string uri() const; virtual std::string str() const; virtual void set_text(const std::string &); virtual bool equals(const node *) const; virtual bool is_id() const; template<size_t N> decltype(auto) get() const; void swap(attribute &); virtual node * clone() const; virtual node * move(); // protected member functions virtual void write(std::ostream &, format_info) const; };
attribute
public member functionsbool operator==(const attribute & a) const;
bool operator!=(const attribute & a) const;
bool operator<(const attribute & ns) const;
virtual std::string get_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.
virtual void set_qname(const std::string & qn);
virtual void set_qname(const std::string & prefix, const std::string & 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: |
|
bool is_namespace() const;Is this attribute an xmlns attribute?
std::string value() const;
void value(const std::string & v);
std::string uri() const;same as value, but checks to see if this really is a namespace attribute
virtual std::string str() const;return all content concatenated, including that of children.
virtual void set_text(const std::string & value);Set text, what really happens depends on the type of the subclass implementing this method.
virtual bool equals(const node * n) const;compare nodes for equality
virtual bool is_id() const;returns whether this attribute is an ID attribute, as defined in an accompanying DTD
template<size_t N> decltype(auto) get() const;support for structured binding
void swap(attribute & a);
virtual node * clone() const;return an exact copy of this node, including all data in sub nodes
virtual node * move();
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.
attribute
protected member functionsvirtual void write(std::ostream & os, format_info fmt) const;low level routine for writing out XML
This method is usually called by operator<<(std::ostream&, zeep::xml::document&)