Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Node Class Reference

The super-class for all specific Node type of an XML document. More...

#include <cxxtools/xml/node.h>

Inheritance diagram for Node:

Characters Comment DocTypeDeclaration EndDocument EndElement ProcessingInstruction StartElement

List of all members.

Public Types

enum  Type {
  Unknown = 0,
  StartDocument = 1,
  DocType = 2,
  EndDocument = 3,
  StartElement = 4,
  EndElement = 5,
  Characters = 6,
  Comment,
  ProcessingInstruction
}

Public Member Functions

 Node (Type type)
 Constructs a new Node object with the specified node type.
virtual ~Node ()
 Empty destructor.
Type type () const
 Returns the type of this Node that can be used to determine what specific Node this object is.
virtual bool operator== (const Node &node) const
 Compares this Node object with the given node.
virtual Nodeclone () const =0


Detailed Description

A Node may for example be a opening tag, a closing tag, a comment or a doctype declaration. The supported node types are contained in the enum Type. To determine the type of a Node the method type() can be used.

For every supported node type (except "Unknown") a specialized class exists that is derived from this Node class. Those classes contain more data and access methods to allow the user to determine the information specific to the node, for example the tag name for a StartElement.

This class mainly provides the method type() to determine the type of the Node. The user may use this information to determine to which specialized class that is associated with the type this object can be cast; for the Node::StartElement type the Node object can be cast to StartElement, for example.

See also:
Type

Member Enumeration Documentation

enum Type

Enumerator:
Unknown  Unknown Node type (may not currently be supported).
StartDocument  Xml declaration (see class XmlDeclaration).
DocType  Doctype (see class DocType).
EndDocument  End of the document (see EndDocument).
StartElement  Start element aka opening tag (see StartElement).
EndElement  End element aka closing tag (see EndElement).
Characters  Parsed content of a tag's body (see Characters).
Comment  Comment (see Comment).
ProcessingInstruction  Processing instruction (see ProcessingInstruction).


Constructor & Destructor Documentation

Node ( Type  type  ) 

See also:
Type


Member Function Documentation

Type type (  )  const

This information may be used to determine to which specialized Node class that is associated with the type, this Node object can be cast; for the Node::StartElement type the Node object can be cast to StartElement, for example.

Returns:
The type of this node.

virtual bool operator== ( const Node node  )  const [virtual]

The return value of the generic operator== method is always false. Class which derive from this class should always override this method and provide a useful comparison, for example by comparing the node type and contents of the current and given Node object

Parameters:
node In subclasses this Node object is compared to the current Node object.
Returns:
In sub-classes $true is returned if this Node object is the same as the given Node object. In this generic class $false$ is always returned.

Reimplemented in Characters, EndElement, and StartElement.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6