Base Framework
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
Node Class Reference

DOM node. More...

#include <base/xml/Node.h>

Inherits AutomationObject.

Inherited by Attribute, CharacterData, Declaration, Document, DocumentFragment, DocumentType, Element, Entity, EntityReference, Notation, and ProcessingInstruction.

Classes

struct  Context
 
class  ShadowDocument
 
class  ShadowElement
 

Public Types

enum  NodeType {
  ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE,
  ENTITY_REFERENCE_NODE, ENTITY_NODE, PROCESSING_INSTRUCTION_NODE, COMMENT_NODE,
  DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE,
  ATTRIBUTE_DECL_NODE, ELEMENT_DECL_NODE, ENTITY_DECL_NODE
}
 

Public Member Functions

 Node () noexcept
 
 Node (const Node &copy) noexcept
 
Nodeoperator= (const Node &assign) noexcept
 
Node appendChild (Node child)
 
Node insertBefore (Node newChild, Node refChild)
 
Node removeChild (Node child)
 
Node replaceChild (Node newChild, Node oldChild)
 
Node cloneNode (bool deep)
 
String getLocalName () const noexcept
 
String getNamespaceURI () const noexcept
 
String getName () const
 
NodeType getType () const
 
String getValue () const
 
ShadowDocument getOwnerDocument () noexcept
 
String getPrefix () const
 
void setPrefix (const String &prefix)
 
Node getParent () const noexcept
 
Node getPreviousSibling () const noexcept
 
Node getNextSibling () const noexcept
 
Node getFirstChild () const
 
Node getLastChild () const
 
bool hasAttributes () const noexcept
 
bool hasChildNodes () const
 
bool isSupported (const String &feature, const String &version) const noexcept
 
void normalize ()
 
void setValue (const String &value)
 
bool isValid () const noexcept
 
bool isInvalid () const noexcept
 
bool isUnlinked () const noexcept
 
bool isSame (const Node &node) const noexcept
 
bool operator== (const Node &node) const noexcept
 
bool hasSameOwner (const Node &node) const noexcept
 
bool isAncestor (const Node &node) const noexcept
 
 operator bool () const noexcept
 
 ~Node () noexcept
 

Protected Member Functions

 Node (void *_context) noexcept
 
void * getContext () noexcept
 
const void * getContext () const noexcept
 

Detailed Description

DOM node.

DOM node.

Version
1.0
Examples
testsuite/dom.cpp, and testsuite/sax.cpp.

Member Enumeration Documentation

◆ NodeType

Leaf node types.

Constructor & Destructor Documentation

◆ Node() [1/3]

Node::Node ( void *  _context)
inlineprotectednoexcept

Initializes node.

◆ Node() [2/3]

Node::Node ( )
inlinenoexcept

Initializes XML node as invalid.

◆ Node() [3/3]

Node::Node ( const Node copy)
inlinenoexcept

Initializes XML node from other XML node.

◆ ~Node()

Node::~Node ( )
noexcept

Destroys the handle. The node is destroyed when detached.

Member Function Documentation

◆ appendChild()

Node Node::appendChild ( Node  child)

Adds the node to the end of the list of children of this node.

Returns
The node being appended.
Examples
testsuite/sax.cpp.

◆ cloneNode()

Node Node::cloneNode ( bool  deep)

Returns a duplicate of this node.

◆ getContext() [1/2]

const void* Node::getContext ( ) const
inlineprotectednoexcept

Returns the context for non-modifiable access.

◆ getContext() [2/2]

void* Node::getContext ( )
inlineprotectednoexcept

Returns the context for modifying access.

◆ getFirstChild()

Node Node::getFirstChild ( ) const

Returns the first child node.

◆ getLastChild()

Node Node::getLastChild ( ) const

Returns the last child node.

◆ getLocalName()

String Node::getLocalName ( ) const
noexcept

Returns the local part of the qualified name of this node.

◆ getName()

String Node::getName ( ) const

Returns the name of the node.

◆ getNamespaceURI()

String Node::getNamespaceURI ( ) const
noexcept

The namespace URI of this node, or an improper string if it is unspecified.

◆ getNextSibling()

Node Node::getNextSibling ( ) const
noexcept

Returns the node immediately succeeding this node.

Examples
testsuite/dom.cpp.

◆ getOwnerDocument()

ShadowDocument Node::getOwnerDocument ( )
noexcept

Returns the Document object associated with this node.

◆ getParent()

Node Node::getParent ( ) const
noexcept

Returns the parent node.

Examples
testsuite/sax.cpp.

◆ getPrefix()

String Node::getPrefix ( ) const

The namespace prefix of this node, or an improper string if it is unspecified.

◆ getPreviousSibling()

Node Node::getPreviousSibling ( ) const
noexcept

Returns the node immediately preceding this node.

◆ getType()

NodeType Node::getType ( ) const

Returns the type of the node.

Examples
testsuite/dom.cpp.

◆ getValue()

String Node::getValue ( ) const

Returns the value of the node.

◆ hasAttributes()

bool Node::hasAttributes ( ) const
noexcept

Returns whether this node (if it is an element) has any attributes.

◆ hasChildNodes()

bool Node::hasChildNodes ( ) const

Returns whether this node has any children.

Examples
testsuite/dom.cpp.

◆ hasSameOwner()

bool Node::hasSameOwner ( const Node node) const
noexcept

Returns true if the specified node has the same owner as this node.

◆ insertBefore()

Node Node::insertBefore ( Node  newChild,
Node  refChild 
)

Inserts the node newChild before the existing child node refChild. If refChild is invalid, insert newChild at the end of the list of children. If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.

Returns
The node being inserted.

◆ isAncestor()

bool Node::isAncestor ( const Node node) const
noexcept

Returns true if this node is an ancestor of the specified node.

◆ isInvalid()

bool Node::isInvalid ( ) const
inlinenoexcept

Returns true if the node has been initialized.

◆ isSame()

bool Node::isSame ( const Node node) const
inlinenoexcept

Returns true if the nodes refer to the the same node.

◆ isSupported()

bool Node::isSupported ( const String feature,
const String version 
) const
noexcept

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.

◆ isUnlinked()

bool Node::isUnlinked ( ) const
noexcept

Returns true if the node is unlinked.

◆ isValid()

bool Node::isValid ( ) const
inlinenoexcept

Returns true if the node has been initialized.

Examples
testsuite/dom.cpp.

◆ normalize()

void Node::normalize ( )

Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g. elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.

◆ operator bool()

Node::operator bool ( ) const
inlinenoexcept

Returns true if the node is valid.

◆ operator=()

Node& Node::operator= ( const Node assign)
inlinenoexcept

Assignment of node by node.

◆ operator==()

bool Node::operator== ( const Node node) const
inlinenoexcept

Returns true if the nodes refer to the the same node.

◆ removeChild()

Node Node::removeChild ( Node  child)

Removes the child node indicated by child from the list of children, and returns it.

◆ replaceChild()

Node Node::replaceChild ( Node  newChild,
Node  oldChild 
)

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

◆ setPrefix()

void Node::setPrefix ( const String prefix)

Sets the prefix.

◆ setValue()

void Node::setValue ( const String value)

Sets the value of the node.