DOMNode
interface is the primary datatype for the entire Document Object Model.
More...
#include <DOMNode.hpp>
Inheritance diagram for xercesc::DOMNode:
Public Types | |
Public Contants | |
enum | NodeType { ELEMENT_NODE = 1, ATTRIBUTE_NODE = 2, TEXT_NODE = 3, CDATA_SECTION_NODE = 4, ENTITY_REFERENCE_NODE = 5, ENTITY_NODE = 6, PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = 11, NOTATION_NODE = 12 } |
NodeType. More... | |
enum | DOMTreePosition { TREE_POSITION_PRECEDING = 0x01, TREE_POSITION_FOLLOWING = 0x02, TREE_POSITION_ANCESTOR = 0x04, TREE_POSITION_DESCENDANT = 0x08, TREE_POSITION_EQUIVALENT = 0x10, TREE_POSITION_SAME_NODE = 0x20, TREE_POSITION_DISCONNECTED = 0x00 } |
TreePosition:. More... | |
Public Member Functions | |
Destructor | |
virtual | ~DOMNode () |
Destructor. | |
Functions introduced in DOM Level 1 | |
virtual const XMLCh * | getNodeName () const =0 |
The name of this node, depending on its type; see the table above. | |
virtual const XMLCh * | getNodeValue () const =0 |
Gets the value of this node, depending on its type. | |
virtual short | getNodeType () const =0 |
An enum value representing the type of the underlying object. | |
virtual DOMNode * | getParentNode () const =0 |
Gets the parent of this node. | |
virtual DOMNodeList * | getChildNodes () const =0 |
Gets a DOMNodeList that contains all children of this node. | |
virtual DOMNode * | getFirstChild () const =0 |
Gets the first child of this node. | |
virtual DOMNode * | getLastChild () const =0 |
Gets the last child of this node. | |
virtual DOMNode * | getPreviousSibling () const =0 |
Gets the node immediately preceding this node. | |
virtual DOMNode * | getNextSibling () const =0 |
Gets the node immediately following this node. | |
virtual DOMNamedNodeMap * | getAttributes () const =0 |
Gets a DOMNamedNodeMap containing the attributes of this node (if it is an DOMElement ) or null otherwise. | |
virtual DOMDocument * | getOwnerDocument () const =0 |
Gets the DOMDocument object associated with this node. | |
virtual DOMNode * | cloneNode (bool deep) const =0 |
Returns a duplicate of this node. | |
virtual DOMNode * | insertBefore (DOMNode *newChild, DOMNode *refChild)=0 |
Inserts the node newChild before the existing child node refChild . | |
virtual DOMNode * | replaceChild (DOMNode *newChild, DOMNode *oldChild)=0 |
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. | |
virtual DOMNode * | removeChild (DOMNode *oldChild)=0 |
Removes the child node indicated by oldChild from the list of children, and returns it. | |
virtual DOMNode * | appendChild (DOMNode *newChild)=0 |
Adds the node newChild to the end of the list of children of this node. | |
virtual bool | hasChildNodes () const =0 |
This is a convenience method to allow easy determination of whether a node has any children. | |
virtual void | setNodeValue (const XMLCh *nodeValue)=0 |
Sets the value of the node. | |
Functions introduced in DOM Level 2. | |
virtual void | normalize ()=0 |
Puts all DOMText nodes in the full depth of the sub-tree underneath this DOMNode , including attribute nodes, into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates DOMText nodes, i.e., there are neither adjacent DOMText nodes nor empty DOMText nodes. | |
virtual bool | isSupported (const XMLCh *feature, const XMLCh *version) const =0 |
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node. | |
virtual const XMLCh * | getNamespaceURI () const =0 |
Get the namespace URI of this node, or null if it is unspecified. | |
virtual const XMLCh * | getPrefix () const =0 |
Get the namespace prefix of this node, or null if it is unspecified. | |
virtual const XMLCh * | getLocalName () const =0 |
Returns the local part of the qualified name of this node. | |
virtual void | setPrefix (const XMLCh *prefix)=0 |
Set the namespace prefix of this node. | |
virtual bool | hasAttributes () const =0 |
Returns whether this node (if it is an element) has any attributes. | |
Functions introduced in DOM Level 3. | |
virtual bool | isSameNode (const DOMNode *other) const =0 |
Returns whether this node is the same node as the given one. | |
virtual bool | isEqualNode (const DOMNode *arg) const =0 |
Tests whether two nodes are equal. | |
virtual void * | setUserData (const XMLCh *key, void *data, DOMUserDataHandler *handler)=0 |
Associate an object to a key on this node. | |
virtual void * | getUserData (const XMLCh *key) const =0 |
Retrieves the object associated to a key on a this node. | |
virtual const XMLCh * | getBaseURI () const =0 |
The absolute base URI of this node or null if undefined. | |
virtual short | compareTreePosition (const DOMNode *other) const =0 |
Compares a node with this node with regard to their position in the tree and according to the document order. | |
virtual const XMLCh * | getTextContent () const =0 |
This attribute returns the text content of this node and its descendants. | |
virtual void | setTextContent (const XMLCh *textContent)=0 |
This attribute removes any possible children this node may have and, if the new string is not empty or null, replaced by a single DOMText node containing the string this attribute is set to. | |
virtual const XMLCh * | lookupNamespacePrefix (const XMLCh *namespaceURI, bool useDefault) const =0 |
Look up the prefix associated to the given namespace URI, starting from this node. | |
virtual bool | isDefaultNamespace (const XMLCh *namespaceURI) const =0 |
This method checks if the specified namespaceURI is the default namespace or not. | |
virtual const XMLCh * | lookupNamespaceURI (const XMLCh *prefix) const =0 |
Look up the namespace URI associated to the given prefix, starting from this node. | |
virtual DOMNode * | getInterface (const XMLCh *feature)=0 |
This method makes available a DOMNode 's specialized interface. | |
Non-standard Extension | |
virtual void | release ()=0 |
Called to indicate that this Node (and its associated children) is no longer in use and that the implementation may relinquish any resources associated with it and its associated children. | |
Protected Member Functions | |
Hidden constructors | |
DOMNode () | |
DOMNode (const DOMNode &) |
DOMNode
interface is the primary datatype for the entire Document Object Model.
It represents a single node in the document tree. While all objects implementing the DOMNode
interface expose methods for dealing with children, not all objects implementing the DOMNode
interface may have children. For example, DOMText
nodes may not have children, and adding children to such nodes results in a DOMException
being raised.
The attributes nodeName
, nodeValue
and attributes
are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific nodeType
(e.g., nodeValue
for an DOMElement
or attributes
for a DOMComment
), this returns null
. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.
The values of nodeName
, nodeValue
, and attributes
vary according to the node type as follows:
Interface | nodeName | nodeValue | attributes |
DOMAttr | name of attribute | value of attribute | null |
DOMCDATASection | "cdata-section" | content of the CDATA Section | null |
DOMComment | "comment" | content of the comment | null |
DOMDocument | "document" | null | null |
DOMDocumentFragment | "document-fragment" | null | null |
DOMDocumentType | document type name | null | null |
DOMElement | tag name | null | NamedNodeMap |
DOMEntity | entity name | null | null |
DOMEntityReference | name of entity referenced | null | null |
DOMNotation | notation name | null | null |
DOMProcessingInstruction | target | entire content excluding the target | null |
DOMText | "text" | content of the text node | null |
See also the Document Object Model (DOM) Level 2 Core Specification.
|
TreePosition:. "Experimental - subject to change"
|
|
NodeType.
|
|
|
|
|
|
Destructor.
|
|
Adds the node
If the
|
|
Returns a duplicate of this node. This function serves as a generic copy constructor for nodes.
The duplicate node has no parent (
|
|
Compares a node with this node with regard to their position in the tree and according to the document order. This order can be extended by module that define additional types of nodes. "Experimental - subject to change"
|
|
Gets a
|
|
The absolute base URI of this node or
This value is computed according to . However, when the "Experimental - subject to change"
|
|
Gets a
If there are no children, this is a
|
|
Gets the first child of this node.
If there is no such node, this returns
|
|
This method makes available a "Experimental - subject to change"
|
|
Gets the last child of this node.
If there is no such node, this returns
|
|
Returns the local part of the qualified name of this node.
For nodes created with a DOM Level 1 method, such as
|
|
Get the namespace URI of this node, or This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
For nodes of any type other than
|
|
Gets the node immediately following this node.
If there is no such node, this returns
|
|
The name of this node, depending on its type; see the table above.
|
|
An enum value representing the type of the underlying object.
|
|
Gets the value of this node, depending on its type.
|
|
Gets the
This is also the
|
|
Gets the parent of this node.
All nodes, except
|
|
Get the namespace prefix of this node, or
|
|
Gets the node immediately preceding this node.
If there is no such node, this returns
|
|
This attribute returns the text content of this node and its descendants. No serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content. "Experimental - subject to change"
|
|
Retrieves the object associated to a key on a this node.
The object must first have been set to this node by calling "Experimental - subject to change"
|
|
Returns whether this node (if it is an element) has any attributes.
|
|
This is a convenience method to allow easy determination of whether a node has any children.
|
|
Inserts the node
If
|
|
This method checks if the specified "Experimental - subject to change"
|
|
Tests whether two nodes are equal.
"Experimental - subject to change"
|
|
Returns whether this node is the same node as the given one.
"Experimental - subject to change"
|
|
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
|
|
Look up the prefix associated to the given namespace URI, starting from this node. "Experimental - subject to change"
|
|
Look up the namespace URI associated to the given prefix, starting from this node. "Experimental - subject to change"
|
|
Puts all This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.
Note: In cases where the document contains
|
|
Called to indicate that this Node (and its associated children) is no longer in use and that the implementation may relinquish any resources associated with it and its associated children. If this is a document, any nodes it owns (created by DOMDocument::createXXXX()) are also released. Access to a released object will lead to unexpected result.
|
|
Removes the child node indicated by
|
|
Replaces the child node
If
If the
|
|
Sets the value of the node. Any node which can have a nodeValue will also accept requests to set it to a string. The exact response to this varies from node to node -- Attribute, for example, stores its values in its children and has to replace them with a new Text holding the replacement value. For most types of Node, value is null and attempting to set it will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will also be thrown if the node is read-only.
|
|
Set the namespace prefix of this node.
Note that setting this attribute, when permitted, changes the
Note also that changing the prefix of an attribute, that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the
|
|
This attribute removes any possible children this node may have and, if the new string is not empty or null, replaced by a single No parsing is performed, the input string is taken as pure textual content. "Experimental - subject to change"
|
|
Associate an object to a key on this node.
The object can later be retrieved from this node by calling Deletion of the user data remains the responsibility of the application program; it will not be automatically deleted when the nodes themselves are reclaimed.
Both the parameter "Experimental - subject to change"
|