DOM::Node Class Reference
The Node
interface is the primary datatype for the entire Document Object Model.
More...
#include <dom_node.h>
Inheritance diagram for DOM::Node:

Public Types | |
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 } |
An integer indicating which type of node this is. More... | |
Public Member Functions | |
Node (const Node &other) | |
Node (NodeImpl *_impl) | |
Node & | operator= (const Node &other) |
bool | operator== (const Node &other) |
bool | operator!= (const Node &other) |
DOMString | nodeName () const |
The name of this node, depending on its type; see the table above. | |
DOMString | nodeValue () const |
The value of this node, depending on its type; see the table above. | |
void | setNodeValue (const DOMString &) |
see nodeValue | |
unsigned short | nodeType () const |
A code representing the type of the underlying object, as defined above. | |
Node | parentNode () const |
The parent of this node. | |
NodeList | childNodes () const |
A NodeList that contains all children of this node. | |
Node | firstChild () const |
The first child of this node. | |
Node | lastChild () const |
The last child of this node. | |
Node | previousSibling () const |
The node immediately preceding this node. | |
Node | nextSibling () const |
The node immediately following this node. | |
NamedNodeMap | attributes () const |
A NamedNodeMap containing the attributes of this node (if it is an Element ) or null otherwise. | |
Document | ownerDocument () const |
The Document object associated with this node. | |
Node | insertBefore (const Node &newChild, const Node &refChild) |
Inserts the node newChild before the existing child node refChild . | |
Node | replaceChild (const Node &newChild, const Node &oldChild) |
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. | |
Node | removeChild (const Node &oldChild) |
Removes the child node indicated by oldChild from the list of children, and returns it. | |
Node | appendChild (const Node &newChild) |
Adds the node newChild to the end of the list of children of this node. | |
bool | hasChildNodes () |
This is a convenience method to allow easy determination of whether a node has any children. | |
Node | cloneNode (bool deep) |
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. | |
void | normalize () |
Modified in DOM Level 2. | |
bool | isSupported (const DOMString &feature, const DOMString &version) const |
Introduced in DOM Level 2. | |
DOMString | namespaceURI () const |
Introduced in DOM Level 2. | |
DOMString | prefix () const |
Introduced in DOM Level 2. | |
void | setPrefix (const DOMString &prefix) |
see prefix | |
DOMString | localName () const |
Introduced in DOM Level 2. | |
bool | hasAttributes () |
Returns whether this node (if it is an element) has any attributes. | |
void | addEventListener (const DOMString &type, EventListener *listener, const bool useCapture) |
Introduced in DOM Level 2 This method is from the EventTarget interface. | |
void | removeEventListener (const DOMString &type, EventListener *listener, bool useCapture) |
Introduced in DOM Level 2 This method is from the EventTarget interface. | |
bool | dispatchEvent (const Event &evt) |
Introduced in DOM Level 2 This method is from the EventTarget interface. | |
Q_UINT32 | elementId () const |
bool | isNull () const |
tests if this Node is 0. | |
NodeImpl * | handle () const |
unsigned long | index () const |
QString | toHTML () |
void | applyChanges () |
void | getCursor (int offset, int &_x, int &_y, int &height) |
QRect | getRect () |
not part of the DOM. | |
Protected Attributes | |
NodeImpl * | impl |
Friends | |
class | NamedNodeMap |
class | NodeList |
class | HTMLCollection |
class | StyleSheet |
Detailed Description
The Node
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 Node
interface expose methods for dealing with children, not all objects implementing the Node
interface may have children. For example, Text
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 Element or attributes
for a Comment), this returns null
. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.
Definition at line 269 of file dom_node.h.
Member Enumeration Documentation
|
An integer indicating which type of node this is.
The values of nodeName nodeValue attributes tagName null name of attribute value of attribute null #text content of the text node null #cdata-section content of the CDATA Section null name of entity referenced null null entity name null null target entire content excluding the target null #comment content of the comment null #document null null document type name null null #document-fragment null null notation name null null Definition at line 382 of file dom_node.h. |
Member Function Documentation
|
The name of this node, depending on its type; see the table above.
Definition at line 179 of file dom_node.cpp. Referenced by KHTMLPart::executeScript(). |
|
The value of this node, depending on its type; see the table above.
Definition at line 185 of file dom_node.cpp. Referenced by KHTMLPart::selectedText(). |
|
see nodeValue
Definition at line 192 of file dom_node.cpp. |
|
A code representing the type of the underlying object, as defined above.
Definition at line 202 of file dom_node.cpp. Referenced by KHTMLPart::executeScript(), and KHTMLPart::selectedText(). |
|
The parent of this node.
All nodes, except Definition at line 208 of file dom_node.cpp. Referenced by KHTMLPart::khtmlMouseMoveEvent(), KHTMLPart::khtmlMouseReleaseEvent(), and KHTMLPart::selectedText(). |
|
A
If there are no children, this is a Definition at line 214 of file dom_node.cpp. |
|
The first child of this node.
If there is no such node, this returns Definition at line 220 of file dom_node.cpp. Referenced by KHTMLPart::khtmlMouseMoveEvent(), KHTMLPart::khtmlMouseReleaseEvent(), and KHTMLPart::selectedText(). |
|
The last child of this node.
If there is no such node, this returns Definition at line 226 of file dom_node.cpp. |
|
The node immediately preceding this node.
If there is no such node, this returns Definition at line 232 of file dom_node.cpp. |
|
The node immediately following this node.
If there is no such node, this returns Definition at line 238 of file dom_node.cpp. Referenced by KHTMLPart::khtmlMouseMoveEvent(), KHTMLPart::khtmlMouseReleaseEvent(), and KHTMLPart::selectedText(). |
|
A
Definition at line 244 of file dom_node.cpp. |
|
The
This is also the Definition at line 250 of file dom_node.cpp. Referenced by DOM::HTMLImageElement::src(), and DOM::HTMLInputElement::src(). |
|
Inserts the node
If
If
newChild was created from a different document than the one that created this node.NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if Definition at line 261 of file dom_node.cpp. References impl. |
|
Replaces the child node
If the
newChild was created from a different document than the one that created this node.NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if Definition at line 271 of file dom_node.cpp. References impl. |
|
Removes the child node indicated by
oldChild is not a child of this node.
Definition at line 281 of file dom_node.cpp. References impl. |
|
Adds the node
If the
DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
newChild was created from a different document than the one that created this node.NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. Definition at line 291 of file dom_node.cpp. References impl. |
|
This is a convenience method to allow easy determination of whether a node has any children.
Definition at line 309 of file dom_node.cpp. |
|
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
The duplicate node has no parent (
Cloning an
Definition at line 315 of file dom_node.cpp. |
|
Modified in DOM Level 2. 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. 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 [XPointer] lookups) that depend on a particular document tree structure are to be used. Note: In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes. Definition at line 321 of file dom_node.cpp. |
|
Introduced in DOM Level 2. Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
Definition at line 327 of file dom_node.cpp. References DOM::DOMString::upper(). |
|
Introduced in DOM Level 2. The namespace URI of this node, or null if it is unspecified. 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 ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. Note: Per the Namespaces in XML Specification [Namespaces] an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace. Definition at line 336 of file dom_node.cpp. |
|
Introduced in DOM Level 2. The namespace prefix of this node, or null if it is unspecified. Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable. 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 namespaceURI and localName do not change. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. Definition at line 342 of file dom_node.cpp. Referenced by DOM::Document::createAttributeNS(). |
|
see prefix
NAMESPACE_ERR: Raised if the specified prefix is malformed, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" [Namespaces]. Definition at line 348 of file dom_node.cpp. |
|
Introduced in DOM Level 2. Returns the local part of the qualified name of this node. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. Definition at line 357 of file dom_node.cpp. Referenced by DOM::Document::createAttributeNS(), and DOM::Element::setAttributeNS(). |
|
Returns whether this node (if it is an element) has any attributes.
Definition at line 301 of file dom_node.cpp. |
|
Introduced in DOM Level 2 This method is from the EventTarget interface. This method allows the registration of event listeners on the event target. If an EventListener is added to an EventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase. If multiple identical EventListeners are registered on the same EventTarget with the same parameters the duplicate instances are discarded. They do not cause the EventListener to be called twice and since they are discarded they do not need to be removed with the removeEventListener method. Parameters
Definition at line 363 of file dom_node.cpp. |
|
Introduced in DOM Level 2 This method is from the EventTarget interface. This method allows the removal of event listeners from the event target. If an EventListener is removed from an EventTarget while it is processing an event, it will not be triggered by the current actions. EventListeners can never be invoked after being removed. Calling removeEventListener with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
Definition at line 372 of file dom_node.cpp. |
|
Introduced in DOM Level 2 This method is from the EventTarget interface. This method allows the dispatch of events into the implementations event model. Events dispatched in this manner will have the same capturing and bubbling behavior as events dispatched directly by the implementation. The target of the event is the EventTarget on which dispatchEvent is called.
Definition at line 380 of file dom_node.cpp. References DOM::Event::handle(). |
|
tests if this Node is 0. Useful especially, if casting to a derived class:
|
|
not part of the DOM.
Definition at line 423 of file dom_node.cpp. |
The documentation for this class was generated from the following files: