PrevUpHomeNext

Class node

zeep::xml::node

Synopsis

// In header: </home/maarten/projects/libzeep/zeep/xml/node.hpp>


class node {
public:

  // public member functions
  root_node * root();
  const root_node * root() const;
  container * parent();
  const container * parent() const;
  node * next();
  const node * next() const;
  node * prev();
  const node * prev() const;
  std::string lang() const;
  std::string qname() const;
  std::string name() const;
  std::string prefix() const;
  std::string ns() const;
  std::string namespace_for_prefix(const std::string &) const;
  std::string prefix_for_namespace(const std::string &) const;
  std::string str() const;
  void write_content(std::ostream &, const char * = kWhiteSpaceChar) const;
  void write(writer &) const;
  bool equals(const node *) const;
  node * clone() const;
  void validate();
};

Description

Node is the abstract base class for all data contained in zeep XML documents. The DOM tree consists of nodes that are linked to each other, each node can have a parent and siblings pointed to by the next and previous members. All nodes in a DOM tree share a common root node.

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. the convenience functions name() and prefix() parse the qname(). ns() returns the namespace URI for the node, if it can be resolved.

Nodes inherit the namespace of their parent unless they override it which means resolving prefixes and namespaces is done hierarchically

node public member functions

  1. root_node * root();
    The root node for this node.
  2. const root_node * root() const;
    The root node for this node.
  3. container * parent();
    The root node for this node.
  4. const container * parent() const;
    The root node for this node.
  5. node * next();
    The next sibling.
  6. const node * next() const;
    The next sibling.
  7. node * prev();
    The previous sibling.
  8. const node * prev() const;
    The previous sibling.
  9. std::string lang() const;
    content of a xml:lang attribute of this element, or its nearest ancestor
  10. 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.

  11. std::string name() const;
    The name for the node as parsed from the qname.
  12. std::string prefix() const;
    The prefix for the node as parsed from the qname.
  13. std::string ns() const;
    Returns the namespace URI for the node, if it can be resolved.
  14. std::string namespace_for_prefix(const std::string & prefix) const;
    Return the namespace URI for a prefix.
  15. std::string prefix_for_namespace(const std::string & uri) const;
    Return the prefix for a namespace URI.
  16. std::string str() const;
    return all content concatenated, including that of children.
  17. void write_content(std::ostream & os, const char * sep = kWhiteSpaceChar) const;
    write out the concatenated content to a stream, separated by sep.
  18. void write(writer & w) const;
    writing out
  19. bool equals(const node * n) const;
    Compare the node with n.
  20. node * clone() const;
    Deep clone the node.
  21. void validate();
    debug routine

PrevUpHomeNext