📄 dom3.h
字号:
const DOMString& data) = 0; //! Creates an attribute /*! Creates an @c Attr of the given name. Note that the @c Attr instance can then be set on an @c Element using the @c setAttributeNode method. To create an attribute with a qualified name and namespace URI, use the @c createAttributeNS method. @param name The name of the attribute */ virtual Attr* createAttribute( const DOMString& name) = 0; //! Creates an entity reference /*! Creates an @c EntityReference object. In addition, if the referenced entity is known, the child list of the @c EntityReference node is made the same as that of the corresponding @c Entity node. @param name The name of the entity to reference */ virtual EntityReference* createEntityReference( const DOMString& name) = 0; //! Gets the elements by tag name /*! Returns a @c NodeList of all the @c Elements with a given tag name in the order in which they are encountered in a preorder traversal of the @c Document tree. @param tagName The name of the tag to match on. The special value "*" matches all tags. */ virtual NodeList* getElementsByTagName( const DOMString& tagName) = 0; // Introduced in DOM Level 2: //! Imports a node /*! Imports a node from another document to this document. The returned node has no parent; (@c parentNode is @c null). The source node is not altered or removed from the original document; this method creates a new copy of the source code. For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's @c nodeName and @c nodeType, plus the attributes related to namespaces (@c prefix, @c localName, and @c namespaceURI). As in the @c cloneNode operation on a @c Node, the source node is not altered. @see Node */ virtual Node* importNode( const Node* importNode, const bool& deep) = 0; //! Creates an element's namespace /*! Creates an element of the given qualified name and namespace URI @param namespaceURI The namespace URI of the element to create @param qualifiedName The qualified name of the element type to instatiate */ virtual Element* createElementNS( const DOMString& namespaceURI, const DOMString& qualifiedName) = 0; //! Creates an attribute's namespace /*! Creates an attribute of the given qualified name and namespace URI @param namespaceURI The namespace URI of the attribute to create @param qualifiedName The qualified name of the attribute to instatiate */ virtual Attr* createAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName) = 0; //! Gets the elements by tag name namespace /*! Returns a @c NodeList of all the @c Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the @c Document tree @param namespaceURI The namespace URI of the elements to match on. The special value "*" matches all namespaces @param localname of the elements to match on. The special value "*" matches all local names */ virtual NodeList* getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Gets element by id /*! Returns the @c Element whose @c ID is given by @c elementId. If no such element exists, returns @c null. Behaviour is not defined if more than one element has @c ID. @param elementId The unique @c id value for an element */ virtual Element* getElementById( const DOMString& elementId) = 0; // Introduced in DOM Level 3: //! Returns the actual encoding /*! Returns a @c DOMString specifying the actual encoding of this document. This is @c null otherwise. */ virtual const DOMString* actualEncoding() const = 0; //! Sets the actual encoding /*! Sets the actual encoding to the specified value. This is not part of the W3C DOM Level 3.. @param newActualEncoding The new actual encoding to set the actual encoding to. */ virtual void setActualEncoding( const DOMString& newActualEncoding) = 0; //! Returns the encoding /*! Returns a @c DOMString specifying, as part of the XML declaration, the encoding of this document. This is @c null when unspecified. */ virtual const DOMString* encoding() const = 0; //! Sets the encoding /*! Sets the encoding of the document to the specified @c DOMString. This is not defined in the W3C DOM level 3. @param newEncoding The new encoding to set for the document */ virtual void setEncoding( const DOMString& newEncoding) = 0; //! Determines if document is standalone /*! Returns a boolean specifying, as part of the XML declaration, whether this document is standalone. */ virtual bool standalone() const = 0; //! Sets the document to be standalone /*! Sets the boolean specifying that the document is standalone. This is not defined in the W3C DOM level 3. @param newStandalone A boolean specifying if the document is standalone or not */ virtual void setStandalone( const bool& newStandalone) = 0; //! Determines if strict error checking is on /*! Returns a boolean specifying whether error checking is enforced or not. When set to @c false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any @c DOMException. In case of error, the behaviour is undefined. This is set to @c true by default. */ virtual bool strictErrorChecking() const = 0; //! Sets strict error checking /*! Turns strict error checking on by setting the appropriate flag. @param newStrictErrorChecking Boolean value defining whether or not strict error checking is on */ virtual void setStrictErrorChecking( const bool& newStrictErrorChecking) = 0; //! Returns version as DOMString /*! Returns a @c DOMString specifying, as part of the XML declaration, the version number of this document. This is @c null when unspecified. */ virtual const DOMString* version() const = 0; //! Sets the version /*! Sets the version number of the document to the @c DOMString specified. @param newVersion The new version number */ virtual void setVersion( const DOMString& newVersion) = 0; //! Adopts a node /*! Changes the @c ownerDocument of a node, its children, as well as the attached attribute nodes if there are any. If the node has a parent it is first removed from its parent child list. This effectively allows moving a subtree from one document to another. @param source The node to move into this document */ virtual Node* adoptNode( Node* source) = 0; //! Sets the base URI /*! Set the @c baseURI attribute from the @c Node interface. @param baseURI The new absolute URI for this document */ virtual void setBaseURI( const DOMString *const baseURI) = 0;};// ******************************************************************************// ******************************************************************************// Element// ******************************************************************************// ******************************************************************************//! Element class/*! The @c Element interface represents an element in an XML document. Elements may have attributes associated with them; since the @c Element interface inherits from @c Node, the generic @c Node interface attribute @c attributes may be used to retrieve the set of all attributes by name or an attribute value by name. In XML, where an attribute value may contain entity references, an @c Attr object should be retrieved to examine the possibly failry complex sub-tree representing the attribute value.*/class Element : public virtual Node {public : //! Returns the tag name as a DOMString /*! Returns the name of the element, for example \verbatim <elementExample> ... </elementExample> \endverbatim @c tagName is the value @c elementExample */ virtual const DOMString* tagName() const = 0; //! Gets the attribute as a DOMString /*! Retrieves an attribute value by name. @param name The name of the attribute to retrieve */ virtual const DOMString* getAttribute( const DOMString& name) const = 0; //! Sets an attribute /*! Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the @c value parameter. This value is a simple string; it is not parsed as it is being set. In order to assign an attribute value that contains entity references, the user must create an @c Attr node plus any @c Text and @c EntityReference nodes, build the appropriate subtree, and use @c setAttributeNode to assign it as the value of an attribute. To set an attribute with a qualified name and namespace URI, use the @c setAttributeNS method. @param name The name of the attribute to create or alter @param value Value to set in string form */ virtual void setAttribute( const DOMString& name, const DOMString& value) = 0; //! Removes an attribute /*! Removes an attribute by name. If the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name and prefix when applicable. To remove an attribute by local name and namespace URI, use the @c removeAttributeNS method. @param name The name of the attribute to remove */ virtual void removeAttribute( const DOMString& name) = 0; //! Gets an attribute node /*! Retrieves an attribute node by name. To retrieve an attribute node by qualified name and namespace URI, use the @c getAttributeNodeNS method. @param name The name (@c nodeName) of the attribute to retrieve */ virtual Attr* getAttributeNode( const DOMString& name) = 0; //! Sets an attribute node /*! Adds a new attribute node. If an attribute with that name (@c nodeName) is already present in the element, it is replaced by the new one. To add a new attribute node with a qualified name and namespace URI, use the @c setAttributeNodeNS method. @param newAttr The @c Attr node to add to the attribute list */ virtual Attr* setAttributeNode( Attr& newAttr) = 0; //! Removes an attribute node /*! Removes the specified attribute node. If the removed @c Attr has a default value it is immediately replaced. The replacing attribute has the same namespaceURI and local name, as well as the original prefix, when applicable. @param oldAttr The @c Attr node to remove from the attribute list */ virtual Attr* removeAttributeNode( Attr& oldAttr) = 0; //! Gets elements by tag name virtual const NodeList* getElementsByTagName( const DOMString& name, const bool& deep) const = 0; // Introduced in DOM Level 2: //! Gets the attribute's namespace /*! Retrieves an attribute value by local name and namespace URI. 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 a non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The namespace URI of the attribute to retrieve @param localname The local name of the attribute to retrieve */ virtual const DOMString* getAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -