📄 dom_document.hpp
字号:
* object with the <CODE>nodeName</CODE> attribute set to * <CODE>name</CODE>, and <CODE>localName</CODE>, <CODE>prefix</CODE>, * and <CODE>namespaceURI</CODE> set to * <CODE>null</CODE>. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an * illegal character. */ DOM_Attr createAttribute(const DOMString &name); /** * Creates an EntityReference object. * * @param name The name of the entity to reference. * @return A <code>DOM_EntityReference</code> that references the newly * created EntityReference node. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified name contains an * illegal character. */ DOM_EntityReference createEntityReference(const DOMString &name); /** * Creates a NodeIterator object. (DOM2) * * NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the * document subtree governed by a particular node, the results of a query, or any other set of nodes. * The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2 * specifies a single NodeIterator implementation for document-order traversal of a document subtree. * Instances of these iterators are created by calling <code>DocumentTraversal.createNodeIterator()</code>. * * To produce a view of the document that has entity references expanded and does not * expose the entity reference node itself, use the <code>whatToShow</code> flags to hide the entity * reference node and set expandEntityReferences to true when creating the iterator. To * produce a view of the document that has entity reference nodes but no entity expansion, * use the <code>whatToShow</code> flags to show the entity reference node and set * expandEntityReferences to false. * * @param root The root node of the DOM tree * @param whatToShow This attribute determines which node types are presented via the iterator. * @param filter The filter used to screen nodes * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are * visible to the iterator. If false, they will be skipped over. */ DOM_NodeIterator createNodeIterator(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion); /** * Creates a TreeWalker object. (DOM2) * * TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined * by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs * navigation using a TreeWalker will automatically support any view defined by a TreeWalker. * * Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from * the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may * be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips * all nodes except for Text nodes and the root node of a document. In the logical view that results, all text * nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the * structure of the original document. * * To produce a view of the document that has entity references expanded * and does not expose the entity reference node itself, use the whatToShow * flags to hide the entity reference node and set <code>expandEntityReferences</code> to * true when creating the TreeWalker. To produce a view of the document * that has entity reference nodes but no entity expansion, use the * <code>whatToShow</code> flags to show the entity reference node and set * <code>expandEntityReferences</code> to false * * @param root The root node of the DOM tree * @param whatToShow This attribute determines which node types are presented via the tree-walker. * @param filter The filter used to screen nodes * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are * visible to the tree-walker. If false, they will be skipped over. */ DOM_TreeWalker createTreeWalker(DOM_Node root, unsigned long whatToShow, DOM_NodeFilter* filter, bool entityReferenceExpansion); /** * Creates a XMLDecl type Node . Non-Standard (an extension to xerces) * * XMLDecl Nodes are created to get version, encoding and standalone information in a document tree * * This node if created gets attached to a document object or an entity node. There can be no child * to this type of node. * * @param version The version data of the document. Currently possible value is 1.0 * @param encoding The encoding type specified in the document * @param standalone The information whether the document is standalone or not */ DOM_XMLDecl createXMLDecl(const DOMString& version, const DOMString& encoding, const DOMString& standalone); /** * To create the range consisting of boundary-points and offset of the * selected contents * * @return The initial state of the Range such that both the boundary-points * are positioned at the beginning of the corresponding DOM_DOcument, before * any content. The range returned can only be used to select content * associated with this document, or with documentFragments and Attrs for * which this document is the ownerdocument */ DOM_Range createRange(); //@} /** @name Getter functions */ //@{ /** * Get Document Type Declaration (see <code>DOM_DocumentType</code>) associated * with this document. * * For documents without * a document type declaration this returns <code>null</code> reference object. The DOM Level * 1 does not support editing the Document Type Declaration, therefore * <code>docType</code> cannot be altered in any way. */ DOM_DocumentType getDoctype() const; /** * Return the <code>DOMImplementation</code> object that handles this document. */ DOM_DOMImplementation &getImplementation() const; /** * Return a reference to the root element of the document. */ DOM_Element getDocumentElement() const; /** * Returns a <code>DOM_NodeList</code> of all the elements with a * given tag name. The returned node list is "live", in that changes * to the document tree made after a nodelist was initially * returned will be immediately reflected in the node list. * * The elements in the node list are ordered in the same order in which they * would be encountered in a * preorder traversal of the <code>Document</code> tree. * @param tagname The name of the tag to match on. The special value "*" * matches all tags. * @return A reference to a NodeList containing all the matched * <code>Element</code>s. */ DOM_NodeList getElementsByTagName(const DOMString &tagname) const; //@} /** @name Functions introduced in DOM Level 2. */ //@{ /** * Imports a node from another document to this document. * The returned node has no parent (<CODE>parentNode</CODE> is * <CODE>null</CODE>). The source node is not altered or removed from the * original document; this method creates a new copy of the source * node.<BR>For all nodes, importing a node creates a node object owned by * the importing document, with attribute values identical to the source * node's <CODE>nodeName</CODE> and <CODE>nodeType</CODE>, plus the * attributes related to namespaces (prefix and namespaces URI). * * @param importedNode The node to import. * @param deep If <CODE>true</CODE>, recursively import the subtree under the * specified node; if <CODE>false</CODE>, import only the node itself, * as explained above. This does not apply to <CODE>DOM_Attr</CODE>, * <CODE>DOM_EntityReference</CODE>, and <CODE>DOM_Notation</CODE> nodes. * @return The imported node that belongs to this <CODE>DOM_Document</CODE>. * @exception DOMException * NOT_SUPPORTED_ERR: Raised if the type of node being imported is * not supported. */ DOM_Node importNode(const DOM_Node &importedNode, bool deep); /** * Creates an element of the given qualified name and * namespace URI. * * @param namespaceURI The <em>namespace URI</em> of * the element to create. * @param qualifiedName The <em>qualified name</em> * of the element type to instantiate. * @return A new <code>DOM_Element</code> object. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains * an illegal character. * <br> * NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is * malformed, if the <CODE>qualifiedName</CODE> has a prefix and the * <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string, * or if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and * the <CODE>namespaceURI</CODE> is different from * "http://www.w3.org/XML/1998/namespace". */ DOM_Element createElementNS(const DOMString &namespaceURI, const DOMString &qualifiedName); /** * Creates an attribute of the given qualified name and namespace * URI. * * @param namespaceURI The <em>namespace URI</em> of * the attribute to create. * @param qualifiedName The <em>qualified name</em> * of the attribute to instantiate. * @return A new <code>DOM_Attr</code> object. * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains * an illegal character. * <br> * NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is * malformed, if the <CODE>qualifiedName</CODE> has a prefix and the * <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string, * if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and the * <CODE>namespaceURI</CODE> is different from * "http://www.w3.org/XML/1998/namespace", if the * <CODE>qualifiedName</CODE> has a prefix that is "xmlns" and the * <CODE>namespaceURI</CODE> is different from * "http://www.w3.org/2000/xmlns/", or if the * <CODE>qualifiedName</CODE> is "xmlns" and the * <CODE>namespaceURI</CODE> is different from * "http://www.w3.org/2000/xmlns/". */ DOM_Attr createAttributeNS(const DOMString &namespaceURI, const DOMString &qualifiedName); /** * Returns a <code>DOM_NodeList</code> of all the <code>DOM_Element</code>s * with a given <em>local name</em> and * namespace URI in the order in which they would be encountered in a * preorder traversal of the <code>DOM_Document</code> tree. * * @param namespaceURI The <em>namespace URI</em> of * the elements to match on. The special value "*" matches all * namespaces. * @param localName The <em>local name</em> of the * elements to match on. The special value "*" matches all local names. * @return A new <code>DOM_NodeList</code> object containing all the matched * <code>DOM_Element</code>s. */ DOM_NodeList getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName) const; /** * Returns the <code>DOM_Element</code> whose ID is given by <code>elementId</code>. * If no such element exists, returns <code>null</code>. * Behavior is not defined if more than one element has this <code>ID</code>. * <P><B>Note:</B> The DOM implementation must have information that says * which attributes are of type ID. Attributes with the name "ID" are not of * type ID unless so defined. Implementations that do not know whether * attributes are of type ID or not are expected to return * <CODE>null</CODE>.</P> * * @param elementId The unique <code>id</code> value for an element. * @return The matching element. */ DOM_Element getElementById(const DOMString &elementId); /** * Sets whether the DOM implementation performs error checking * upon operations. Turning off error checking only affects * the following DOM checks: * <ul> * <li>Checking strings to make sure that all characters are * legal XML characters * <li>Hierarchy checking such as allowed children, checks for * cycles, etc. * </ul> * <p> * Turning off error checking does <em>not</em> turn off the * following checks: * <ul> * <li>Read only checks * <li>Checks related to DOM events * </ul> */ void setErrorChecking(bool check); /** * Returns true if the DOM implementation performs error checking. */ bool getErrorChecking(); //@}protected: DOM_Document (DocumentImpl *impl); friend class DOM_Node; friend class DocumentImpl; friend class NodeIteratorImpl; friend class DOM_DOMImplementation;};XERCES_CPP_NAMESPACE_END#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -