📄 dom3.h
字号:
//! Sets the attribute's namespace /*! Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to the prefix part of the @c qualifiedName, and its value is changed to be 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 setAttributeNodeNS or @c setAttributeNode to assign it as the value of an attribute. @param namespaceURI The namespace URI of the attribute to create or alter @param qualifiedName The qualified name of the attribute to create or alter @param value The value to set in string form */ virtual void setAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName, const DOMString& value) = 0; //! Removes the attribute's namespace /*! Removes an attribute by local name and namespace URI. If the removed attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix. 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 remove @param localname The local name of the attribute to remove */ virtual void removeAttributeNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Gets the attribute node's namespace /*! Retrieves an @c Attr node 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 Attr* getAttributeNodeNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Sets the attribute node's namespace /*! Adds a new attribute. If an atribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. @param newAttr The @c Attr node to add to the attribute list */ virtual Attr* setAttributeNodeNS( Attr& newAttr) = 0; //! Gets the elements by tag name namespace /*! Returns a @c NodeList of all the descendant @c Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this @c Element tree. 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 name space URI of the elements to match on. The special value "*" matches all namespaces. @param localname The local name of the elements to match on. The special value "*" matches all local names. */ virtual NodeList* getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Determines if node has attribute name /*! Returns @c true when an attribute with a given name is specified on this element or has a default value, @c false otherwise @param name The name of the attribute to look for */ virtual bool hasAttribute( const DOMString& name) const = 0; //! Determines if node has attribute namespace of localname /*! Returns @c true when an attribute with a given local name and namespace URI is specified on this element or has a default value, @c false otherwise. 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 name space URI of the elements to match on. @param localname The local name of the elements to match on. */ virtual bool hasAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const = 0; };// ******************************************************************************// ******************************************************************************// Attr// ******************************************************************************// ******************************************************************************//! Attribute class/*! The @c Attr interface represents an attribute in an @c Element object. Typically the allowable values for the attribute are defined in a document type definition. @c Attr objects inherit the @c Node interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the @c Node attributes @c parentNode, @c previousSibling, and @c nextSibling have a @c null valuue for @c Attr objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make is more efficient to implement such feautures as default attributes associated with all elements of a given type. Furthermore, @c Attr nodes may not be immediate children of a @c DocumentFragment. However, they can be associated with @c Element nodes contained within a @c DocumentFragment.*/class Attr : public virtual Node {public : //! Returns the attribute name as a DOMString /*! Returns the name of this attribute */ virtual const DOMString* name() const = 0; //! Determines if the attribute was given explicitly in the original document /*! If this attribute was explicitly given a value in the original document, this is @c true; otherwise, it is @c false. */ virtual bool specified() const = 0; //! Sets the specified boolean /*! Convenience function to set the @c specified boolean. This is not explicitly defined in the W3C DOM Level 3. @param newSpecified Boolean value to set for the attribute */ virtual void setSpecified( const bool& newSpecified) = 0; //! Returns the attribute value /*! On retrieval, the value of the attribute is returned as a string. Character and genera entity references are replaced with their values. @see @c getAttribute on the @c Element interface On setting, this creates a @c Text node with the unparsed contents of the string. I.e. any characters that an XML processor would recognise as markup are instead treated as literal text. @see @c setAttribute on the @c Element interface */ virtual const DOMString* value() const = 0; //! Sets the attribute value /*! Convenience function to set the attribute value. Not explicitly defined in the W3C DOM Level 3, however, it is certainly implied that such a function should exist. @param newValue The new value of the attribute */ virtual void setValue( const DOMString& newValue) = 0; // Introduced in DOM Level 2: //! Returns the owner element of the attribute /*! Returns the @c Element node this attribute is attached to or @c null if this attribute is not in use. */ virtual const Element* ownerElement() const = 0; //! Sets the owner element of the attribute /*! Convenience function to explicitly set the @c ownerElement of the attribute. Not defined in the W3C DOM Level 3 @param newOwnerElement The new owner element of the attribute */ virtual void setOwnerElement( const Element* newOwnerElement) = 0;};// ******************************************************************************// ******************************************************************************// CharacterData// ******************************************************************************// ******************************************************************************//! CharacterData class/*! The @c CharacterData interface extends @c Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to @c CharacterData, though @c Text and othersdo inherit the interface from it. All @c offsets in this interface start from 0. As explained in the @c DOMString interface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term 16-bit units is used whenever necessary to indicate that indexing on @c CharacterData is done in 16-bit units. Note: I believe that Greg Collecutt only implemented strings in UTF-8, so one must be damn careful when using this implementation of the DOM and that documented both here, and in the 05 June 2001 Working Draft. PTC.*/class CharacterData : public virtual Node {public : //! Returns the data as a DOMString /*! Returns the character data of the node that implements this interface. */ virtual const DOMString* data() const = 0; //! Returns the length of the data /*! Returns the number of 16-bit units that are available through @c data and the @c substringData method. This may have the value zero, i.e., @c CharacterData nodes may be empty. */ virtual unsigned long length() const = 0; //! Returns a substring of the character data of length count characters starting at offset /*! Extracts a range of data from the node. @param offset Start offset of substring to extract @param count The number of 16-bit units to extract */ const virtual DOMString* substringData( unsigned long offset, unsigned long count) const = 0; //! Appends data /*! Append the string to the end of the character data of the node. Upon success, @c data provides access to the concatenation of @c data and the @c DOMString specified. @param arg The @c DOMString to append */ virtual void appendData( const DOMString& arg) = 0; //! Inserts data at offset /*! Insert a string at the specified 16-bit unit offset. @param offset The character offset at which to insert @param arg The @c DOMString to insert */ virtual void insertData( unsigned long offset, const DOMString& arg) = 0; //! Deletes count characters starting at offset /*! Remove a range of 16-bit units from the node. Upon success, @c data and @c length reflect the change. @param offset The offset from which to start removing @param count The number of 16-bit units to delete. If the sum of @c offset and @c count exceeds @c length then all 16-bit units from @c offset to the end of the data are deleted */ virtual void deleteData( unsigned long offset, unsigned long count) = 0; //! Replaces count characters starting at offset /*! Replace the characters starting at the specified 16-bit unit offset with the specified string. @param offset The offset from which to start replacing @param count The number of 16-bit units to replace. If the sum of @c offset and @c count exceeds @c length, then all 16-bit units to the end of the data are replaced; (i.e. the effect is the same as a @c remove method call with the same range, followed by an @c append method invocation). @param arg The @c DOMString with which the range must be replaced */ virtual void replaceData( unsigned long offset, unsigned long count, const DOMString& arg) = 0; //! Sets the data /*! Convenience function to set data in a @c CharacterData object. This is not specified in the W3C DOM Level 3. @param newData The new data that the @c CharacterData object should hold */ virtual void setData( const DOMString& newData) = 0;};// ******************************************************************************// ******************************************************************************// Text// ******************************************************************************// ******************************************************************************//! Text class/*! The @c Text interface inherits from @c CharacterData and represents the textual content (termed @em character @em data in XML) of an @c Element or @c Attr. If there is no markup inside an element's content, the text is contained in a single object implementing the @c Text interface that is the only child of the element. If there is markup, it is parsed into the information items (e
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -