cxxtools::xml::Node Class Reference

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

#include <cxxtools/xml/node.h>

Inheritance diagram for cxxtools::xml::Node:
cxxtools::xml::Characters cxxtools::xml::Comment cxxtools::xml::DocTypeDeclaration cxxtools::xml::EndDocument cxxtools::xml::EndElement cxxtools::xml::ProcessingInstruction cxxtools::xml::StartElement

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 &) const
 Compares this Node object with the given node.
virtual Nodeclone () const =0

Detailed Description

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

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

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

cxxtools::xml::Node::Node ( Type  type)
inline

Constructs a new Node object with the specified node type.

See Also
Type
virtual cxxtools::xml::Node::~Node ( )
inlinevirtual

Empty destructor.

Member Function Documentation

virtual bool cxxtools::xml::Node::operator== ( const Node ) const
inlinevirtual

Compares this Node object with the given node.

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
nodeIn 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 cxxtools::xml::StartElement, cxxtools::xml::Characters, and cxxtools::xml::EndElement.

Type cxxtools::xml::Node::type ( ) const
inline

Returns the type of this Node that can be used to determine what specific Node this object is.

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.

The documentation for this class was generated from the following file: