## Class node

zeep::xml::node

## Synopsis

    // In header: </build/libzeep-8SPbhu/libzeep-3.0.5/zeep/xml/node.hpp>

    class node {
    public:

      // public member functions
      virtual root_node * root();
      virtual const root_node * root() const;
      container * parent();
      const container * parent() const;
      node * next();
      const node * next() const;
      node * prev();
      const node * prev() const;
      virtual std::string lang() const;
      virtual std::string qname() const;
      virtual std::string name() const;
      virtual std::string prefix() const;
      virtual std::string ns() const;
      virtual std::string namespace_for_prefix(const std::string &) const;
      virtual std::string prefix_for_namespace(const std::string &) const;
      virtual std::string str() const = 0;
      virtual void str(const std::string &);
      virtual void
      write_content(std::ostream &, const char * = kWhiteSpaceChar) const;
      virtual void write(writer &) const = 0;
      virtual bool equals(const node *) const;
      virtual node * clone() const;
      virtual 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.     virtual root_node * root();

   The root node for this node.

2.     virtual 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.     virtual std::string lang() const;

   content of a xml:lang attribute of this element, or its nearest ancestor

10.     virtual 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.     virtual std::string name() const;

    The name for the node as parsed from the qname.

12.     virtual std::string prefix() const;

    The prefix for the node as parsed from the qname.

13.     virtual std::string ns() const;

    Returns the namespace URI for the node, if it can be resolved.

14.     virtual std::string namespace_for_prefix(const std::string & prefix) const;

    Return the namespace URI for a prefix.

15.     virtual std::string prefix_for_namespace(const std::string & uri) const;

    Return the prefix for a namespace URI.

16.     virtual std::string str() const = 0;

    return all content concatenated, including that of children.

17.     virtual void str(const std::string & value);

    both attribute and element implement str(const string&), others will throw

18.     virtual void
        write_content(std::ostream & os, const char * sep = kWhiteSpaceChar) const;

    write out the concatenated content to a stream, separated by sep.

19.     virtual void write(writer & w) const = 0;

    writing out

20.     virtual bool equals(const node * n) const;

    Compare the node with n.

21.     virtual node * clone() const;

    Deep clone the node.

22.     virtual void validate();

    debug routine