📄 domnode.hpp
字号:
#ifndef DOMNode_HEADER_GUARD_#define DOMNode_HEADER_GUARD_/* * The Apache Software License, Version 1.1 * * Copyright (c) 2001-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache\@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation, and was * originally based on software copyright (c) 2001, International * Business Machines, Inc., http://www.ibm.com . For more information * on the Apache Software Foundation, please see * <http://www.apache.org/>. *//* * $Id: DOMNode.hpp,v 1.15 2003/05/05 21:21:15 neilg Exp $ */#include <xercesc/util/XercesDefs.hpp>XERCES_CPP_NAMESPACE_BEGINclass DOMDocument;class DOMNamedNodeMap;class DOMNodeList;class DOMUserDataHandler;/** * The <code>DOMNode</code> 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 <code>DOMNode</code> interface expose * methods for dealing with children, not all objects implementing the * <code>DOMNode</code> interface may have children. For example, * <code>DOMText</code> nodes may not have children, and adding children to * such nodes results in a <code>DOMException</code> being raised. * <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and * <code>attributes</code> 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 <code>nodeType</code> (e.g., <code>nodeValue</code> for an * <code>DOMElement</code> or <code>attributes</code> for a <code>DOMComment</code> * ), this returns <code>null</code>. Note that the specialized interfaces * may contain additional and more convenient mechanisms to get and set the * relevant information. * <p>The values of <code>nodeName</code>, * <code>nodeValue</code>, and <code>attributes</code> vary according to the * node type as follows: * <table border='1'> * <tr> * <td>Interface</td> * <td>nodeName</td> * <td>nodeValue</td> * <td>attributes</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMAttr</td> * <td valign='top' rowspan='1' colspan='1'>name of * attribute</td> * <td valign='top' rowspan='1' colspan='1'>value of attribute</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMCDATASection</td> * <td valign='top' rowspan='1' colspan='1'><code>"#cdata-section"</code></td> * <td valign='top' rowspan='1' colspan='1'> * content of the CDATA Section</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMComment</td> * <td valign='top' rowspan='1' colspan='1'><code>"#comment"</code></td> * <td valign='top' rowspan='1' colspan='1'>content of * the comment</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMDocument</td> * <td valign='top' rowspan='1' colspan='1'><code>"#document"</code></td> * <td valign='top' rowspan='1' colspan='1'>null</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMDocumentFragment</td> * <td valign='top' rowspan='1' colspan='1'> * <code>"#document-fragment"</code></td> * <td valign='top' rowspan='1' colspan='1'>null</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMDocumentType</td> * <td valign='top' rowspan='1' colspan='1'>document type name</td> * <td valign='top' rowspan='1' colspan='1'> * null</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMElement</td> * <td valign='top' rowspan='1' colspan='1'>tag name</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * <td valign='top' rowspan='1' colspan='1'>NamedNodeMap</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMEntity</td> * <td valign='top' rowspan='1' colspan='1'>entity name</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMEntityReference</td> * <td valign='top' rowspan='1' colspan='1'>name of entity referenced</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMNotation</td> * <td valign='top' rowspan='1' colspan='1'>notation name</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * <td valign='top' rowspan='1' colspan='1'> * null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMProcessingInstruction</td> * <td valign='top' rowspan='1' colspan='1'>target</td> * <td valign='top' rowspan='1' colspan='1'>entire content excluding the target</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>DOMText</td> * <td valign='top' rowspan='1' colspan='1'> * <code>"#text"</code></td> * <td valign='top' rowspan='1' colspan='1'>content of the text node</td> * <td valign='top' rowspan='1' colspan='1'>null</td> * </tr> * </table> * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>. * * @since DOM Level 1 */class CDOM_EXPORT DOMNode {protected: // ----------------------------------------------------------------------- // Hidden constructors // ----------------------------------------------------------------------- /** @name Hidden constructors */ //@{ DOMNode() {}; //@}private: // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- /** @name Unimplemented constructors and operators */ //@{ DOMNode(const DOMNode &); DOMNode & operator = (const DOMNode &); //@}public: // ----------------------------------------------------------------------- // All constructors are hidden, just the destructor is available // ----------------------------------------------------------------------- /** @name Destructor */ //@{ /** * Destructor * */ virtual ~DOMNode() {}; //@} // ----------------------------------------------------------------------- // Class Types // ----------------------------------------------------------------------- /** @name Public Contants */ //@{ /** * NodeType * * @since DOM Level 1 */ 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 }; /** * TreePosition: * * <p><b>"Experimental - subject to change"</b></p> * * <p><code>TREE_POSITION_PRECEDING:</code> * The node precedes the reference node.</p> * <p><code>TREE_POSITION_FOLLOWING:</code> * The node follows the reference node.</p> * <p><code>TREE_POSITION_ANCESTOR:</code> * The node is an ancestor of the reference node.</p> * <p><code>TREE_POSITION_DESCENDANT:</code> * The node is a descendant of the reference node.</p> * <p><code>TREE_POSITION_EQUIVALENT:</code> * The two nodes have an equivalent position. This is the case of two * attributes that have the same <code>ownerElement</code>, and two * nodes that are the same.</p> * <p><code>TREE_POSITION_SAME_NODE:</code> * The two nodes are the same. Two nodes that are the same have an * equivalent position, though the reverse may not be true.</p> * <p><code>TREE_POSITION_DISCONNECTED:</code> * The two nodes are disconnected, they do not have any common ancestor. * This is the case of two nodes that are not in the same document.</p> * * @since DOM Level 3 */ enum DOMTreePosition { TREE_POSITION_PRECEDING = 0x01, TREE_POSITION_FOLLOWING = 0x02, TREE_POSITION_ANCESTOR = 0x04, TREE_POSITION_DESCENDANT = 0x08, TREE_POSITION_EQUIVALENT = 0x10, TREE_POSITION_SAME_NODE = 0x20, TREE_POSITION_DISCONNECTED = 0x00 }; //@} // ----------------------------------------------------------------------- // Virtual DOMNode interface // ----------------------------------------------------------------------- /** @name Functions introduced in DOM Level 1 */ //@{ // ----------------------------------------------------------------------- // Getter methods // ----------------------------------------------------------------------- /** * The name of this node, depending on its type; see the table above. * @since DOM Level 1 */ virtual const XMLCh * getNodeName() const = 0; /** * Gets the value of this node, depending on its type. * * @exception DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @since DOM Level 1 */ virtual const XMLCh * getNodeValue() const = 0; /** * An enum value representing the type of the underlying object. * @since DOM Level 1 */ virtual short getNodeType() const = 0; /** * Gets the parent of this node. * * All nodes, except <code>DOMDocument</code>, * <code>DOMDocumentFragment</code>, and <code>DOMAttr</code> 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, a <code>null</code> DOMNode * is returned. * @since DOM Level 1 */ virtual DOMNode *getParentNode() const = 0; /** * Gets a <code>DOMNodeList</code> that contains all children of this node. * * If there * are no children, this is a <code>DOMNodeList</code> containing no nodes. * The content of the returned <code>DOMNodeList</code> is "live" in the sense * that, for instance, changes to the children of the node object that * it was created from are immediately reflected in the nodes returned by * the <code>DOMNodeList</code> accessors; it is not a static snapshot of the * content of the node. This is true for every <code>DOMNodeList</code>, * including the ones returned by the <code>getElementsByTagName</code> * method. * @since DOM Level 1 */ virtual DOMNodeList *getChildNodes() const = 0; /** * Gets the first child of this node. * * If there is no such node, this returns <code>null</code>. * @since DOM Level 1 */ virtual DOMNode *getFirstChild() const = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -