📄 dom3.h
字号:
//! Removes the named item namespace /*! Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes atribute of the @c Node interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. Documents which do not support the "XML" feature will permit only the DOM level 1 calls for creating/setting elements and attributes. Hence, if you specify an non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The namespace URI of the node to remove @param localname The local name of the node to remove */ virtual Node* removeNamedItemNS( const DOMString& namespaceURI, const DOMString& localname) = 0; };// ******************************************************************************// ******************************************************************************// Node// ******************************************************************************// ******************************************************************************//! Node class/*! This @c 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 @c Node interface expose methods for dealing with children, not all objects implementing the @c Node interface may have children. For example, @c Text nodes may not have children, and adding children to such nodes results in a @c DOMException being raised. The attributes @c nodeName, @c nodeValue and @c 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 @c nodeType (e.g. @c nodeValue for an @c Element or @c attributes for a @c Comment), this returns @c null. Note that the specialised interfaces may contain additional and more convenient mechanisms to get and set the relevant information.*/class Node {public : //! Destructor virtual ~Node() {}; //! Enumerator containing the document node numbers /*! These are the @c nodeTypes; an integer indicating which type of node this is. The values of @c nodeName, @c nodeValue, and @c attributes vary according to the node type as follows: <table> <tr> <th>Interface</th> <th>nodeName</th> <th>nodeValue</th> <th>attributes</th> </tr> <tr> <td>Attr</td> <td>name of attribute</td> <td>value of attribute</td> <td>null</td> </tr> <tr> <td>CDATASection</td> <td>"#cdata-section"</td> <td>content of the CDATA section</td> <td>null</td> </tr> <tr> <td>Comment</td> <td>"#comment"</td> <td>content of the comment</td> <td>null</td> </tr> <tr> <td>Document</td> <td>"#document"</td> <td>null</td> <td>null</td> </tr> <tr> <td>DocumentFragment</td> <td>"#document-fragment"</td> <td>null</td> <td>null</td> </tr> <tr> <td>DocumentType</td> <td>document type name</td> <td>null</td> <td>null</td> </tr> <tr> <td>Element</td> <td>tag name</td> <td>null</td> <td>NamedNodeMap</td> </tr> <tr> <td>Entity</td> <td>entity name</td> <td>null</td> <td>null</td> </tr> <tr> <td>EntityReference</td> <td>name of entity referenced</td> <td>null</td> <td>null</td> </tr> <tr> <td>Notation</td> <td>notation name</td> <td>null</td> <td>null</td> </tr> <tr> <td>ProcessingInstruction</td> <td>target</td> <td>entire content excluding the target</td> <td>null</td> </tr> <tr> <td>Text</td> <td>"#text"</td> <td>content of the text node</td> <td>null</td> </tr> </table> */ enum { ELEMENT_NODE = 1, //!< The node is an @c Element ATTRIBUTE_NODE = 2, //!< The node is an @c Attr TEXT_NODE = 3, //!< The node is a @c Text node CDATA_SECTION_NODE = 4, //!< The node is a @c CDATASection ENTITY_REFERENCE_NODE = 5, //!< The node is an @c EntityReference ENTITY_NODE = 6, //!< The node is an @c Entity PROCESSING_INSTRUCTION_NODE = 7, //!< The node is a @c ProcessingInstruction COMMENT_NODE = 8, //!< The node is a @c Comment DOCUMENT_NODE = 9, //!< The node is a @c Document DOCUMENT_TYPE_NODE = 10, //!< The node is a @c DocumentType DOCUMENT_FRAGMENT_NODE = 11, //!< The node is a @c DocumentFragment NOTATION_NODE = 12 //!< The node is a @c Notation }; //! Returns the node name as a DOMString /*! Returns the name of this node, depending on its type. */ virtual const DOMString* nodeName() const = 0; //! Returns the node value as a DOMString /*! Returns the value of this node, depending on its type. When it is defined to be @c null, setting it has no effect. */ virtual const DOMString* nodeValue() const = 0; //! Sets the node value /*! Sets the node value to the value specified. @param newNodeValue The new node value */ virtual void setNodeValue( const DOMString& newNodeValue) = 0; //! Returns the node type /*! Returns a code representing the type of the underlying object. */ virtual unsigned long nodeType() const = 0; //! Returns the parent node /*! Returns the parent of this node. All nodes, except @c Attr, @c Document, @c DocumentFragment @c Entity and @c Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is @c null. */ virtual Node* parentNode() const = 0; //! Sets the parent node /*! Sets the parent node of the current node to the @c Node specified. @param newParentNode The new parent node of the current node */ virtual void setParentNode( Node* newParentNode) = 0; //! Returns the child nodes as a node list /*! Returns a @c NodeList that contains all children of this node. If there are no children, this is a @c NodeList containing no nodes. */ virtual const NodeList* childNodes() const = 0; //! Returns the first child node /*! Returns the first child of this node. If there is no such node, this returns @c null. */ virtual Node* firstChild() const = 0; //! Returns the last child node /*! Returns the last child of this node. If there is no such node, this returns @c null. */ virtual Node* lastChild() const = 0; //! Returns the previous sibling node /*! Returns the node immediately preceding this node. If there is no such node, this returns @c null. */ virtual Node* previousSibling() const = 0; //! Returns the next sibling node /*! Returns the node immediately following this node. If there is no such node, this returns @c null. */ virtual Node* nextSibling() const = 0; //! Returns the attributes of the node /*! Returns a @c NamedNodeMap containing the attributes of this node (if it is an @c Element or @c null otherwise). */ virtual const NamedNodeMap* attributes() const = 0; //! Returns the owner document /*! Returns the @c Document object associated with this node. This is also the @c Document object used to create new nodes. When this node is a @c Document or a @c DocumentType which is not used with any @c Document yet, this is @c null. */ virtual const Document* ownerDocument() const = 0; //! Sets the owner document /*! Sets the owner document to the @c Document object specified. @param newOwnerDocument The new @c Document object to own the node */ virtual void setOwnerDocument( const Document *const newOwnerDocument) = 0; //! Inserts child node before reference child node /*! Inserts the node @c newChild before the existing child node @c refChild. If @c refChild is @c null, insert @c newChild at the end of the list of children. If @c newChild is a @c DocumentFragement object, all of its children are inserted, in the same order, before @c refChild. If the @c newChild is already in the tree, it is first removed. @param newChild The node to insert @param refChild The reference node, i.e., the node before which th new node must be inserted */ virtual Node* insertBefore( Node* newChild, Node* refChild) = 0; //! Replaces a child node /*! Replaces the child node @c oldChild with @c newChild in the list of children, and returns the @c oldChild node. If @c newChild is a @c DocumentFragment object, @c oldChild is replaced by all of the @c DocumentFragment children, which are inserted in the same order. If the @c newChild is already in the tree, it is first removed. @param newChild The new node to put in the child list @param oldChild The node being replaced in the list */ virtual Node* replaceChild( Node* newChild, Node* oldChild) = 0; //! Removes a child node /*! Removes the child node indicated by @c oldChild from the list of children, and returns it. @param oldChild The node being removed */ virtual Node* removeChild( Node* oldChild) = 0; //! Appends a child node /*! Adds the node @c newChild to the end of the list of children of this node. If the @c newChild is already in the tree, it is first removed. @param newChild The node to add. If it is a @c DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node */ virtual Node* appendChild( Node* newChild) = 0; //! Determines if object has child nodes /*! Returns whether this node has any children. */ virtual bool hasChildNodes() const = 0; //! Clones a node /*! Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate has ho parent; (@c parentNode is @c null). Cloning an @c Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child @c Text node. Cloning an @c Attribute directly, as opposed to be cloned as part of an @c Element cloning operation, returns a specified attribute (@c specified is @c true). Cloning any other type of node simply returns a copy of this node. @param deep If @c true, recursively clone the subtree under the specified node; if @c false, clone only the node itself (and its attributes, if it is an @c Element). */ virtual Node* cloneNode( const bool& deep) const = 0; //! Puts all Text nodes into a ``normal'' form /*! Puts all @c Text nodes in the full depth of the sub-tree underneath this @c Node, including attriubte nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections and entity references) separates @c Text nodes, i.e., there are neither adjacent @c Text nodes nor empty @c Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and reloaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used. */ virtual void normalize() = 0; // Modified in DOM Level 2: // Introduced in DOM Level 2: //! Determines if feature is supported /*! Tests whether the DOM implementation implements a specific feature and that fearture is supported by this node. @param feature The name of the feature to test. This is the same name which can be passed to the method @c hasFeature on @c DOMImplementation @param version This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supoorting any version of the feature will cause the method to return @c true */ virtual bool isSupported( DOMString& feature, DOMString& version) const = 0; //! Returns the namespace URI as a DOMString /*! Returns the namespace URI of this node, or @c 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 @c ELEMENT_NODE and @c ATTRIBUTE_NODE and nodes created with a DOM
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -