Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:51

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMNODE_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMNODE_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 
0030 class DOMDocument;
0031 class DOMNamedNodeMap;
0032 class DOMNodeList;
0033 class DOMUserDataHandler;
0034 
0035 /**
0036  * The <code>DOMNode</code> interface is the primary datatype for the entire
0037  * Document Object Model. It represents a single node in the document tree.
0038  * While all objects implementing the <code>DOMNode</code> interface expose
0039  * methods for dealing with children, not all objects implementing the
0040  * <code>DOMNode</code> interface may have children. For example,
0041  * <code>DOMText</code> nodes may not have children, and adding children to
0042  * such nodes results in a <code>DOMException</code> being raised.
0043  * <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and
0044  * <code>attributes</code> are included as a mechanism to get at node
0045  * information without casting down to the specific derived interface. In
0046  * cases where there is no obvious mapping of these attributes for a
0047  * specific <code>nodeType</code> (e.g., <code>nodeValue</code> for an
0048  * <code>DOMElement</code> or <code>attributes</code> for a <code>DOMComment</code>
0049  * ), this returns <code>null</code>. Note that the specialized interfaces
0050  * may contain additional and more convenient mechanisms to get and set the
0051  * relevant information.
0052  * <p>The values of <code>nodeName</code>,
0053  * <code>nodeValue</code>, and <code>attributes</code> vary according to the
0054  * node type as follows:
0055  * <table border='1'>
0056  * <tr>
0057  * <td>Interface</td>
0058  * <td>nodeName</td>
0059  * <td>nodeValue</td>
0060  * <td>attributes</td>
0061  * </tr>
0062  * <tr>
0063  * <td valign='top' rowspan='1' colspan='1'>DOMAttr</td>
0064  * <td valign='top' rowspan='1' colspan='1'>name of attribute</td>
0065  * <td valign='top' rowspan='1' colspan='1'>value of attribute</td>
0066  * <td valign='top' rowspan='1' colspan='1'>null</td>
0067  * </tr>
0068  * <tr>
0069  * <td valign='top' rowspan='1' colspan='1'>DOMCDATASection</td>
0070  * <td valign='top' rowspan='1' colspan='1'>&quot;\#cdata-section&quot;</td>
0071  * <td valign='top' rowspan='1' colspan='1'>content of the CDATA Section</td>
0072  * <td valign='top' rowspan='1' colspan='1'>null</td>
0073  * </tr>
0074  * <tr>
0075  * <td valign='top' rowspan='1' colspan='1'>DOMComment</td>
0076  * <td valign='top' rowspan='1' colspan='1'>&quot;\#comment&quot;</td>
0077  * <td valign='top' rowspan='1' colspan='1'>content of the comment</td>
0078  * <td valign='top' rowspan='1' colspan='1'>null</td>
0079  * </tr>
0080  * <tr>
0081  * <td valign='top' rowspan='1' colspan='1'>DOMDocument</td>
0082  * <td valign='top' rowspan='1' colspan='1'>&quot;\#document&quot;</td>
0083  * <td valign='top' rowspan='1' colspan='1'>null</td>
0084  * <td valign='top' rowspan='1' colspan='1'>null</td>
0085  * </tr>
0086  * <tr>
0087  * <td valign='top' rowspan='1' colspan='1'>DOMDocumentFragment</td>
0088  * <td valign='top' rowspan='1' colspan='1'>&quot;\#document-fragment&quot;</td>
0089  * <td valign='top' rowspan='1' colspan='1'>null</td>
0090  * <td valign='top' rowspan='1' colspan='1'>null</td>
0091  * </tr>
0092  * <tr>
0093  * <td valign='top' rowspan='1' colspan='1'>DOMDocumentType</td>
0094  * <td valign='top' rowspan='1' colspan='1'>document type name</td>
0095  * <td valign='top' rowspan='1' colspan='1'>null</td>
0096  * <td valign='top' rowspan='1' colspan='1'>null</td>
0097  * </tr>
0098  * <tr>
0099  * <td valign='top' rowspan='1' colspan='1'>DOMElement</td>
0100  * <td valign='top' rowspan='1' colspan='1'>tag name</td>
0101  * <td valign='top' rowspan='1' colspan='1'>null</td>
0102  * <td valign='top' rowspan='1' colspan='1'>NamedNodeMap</td>
0103  * </tr>
0104  * <tr>
0105  * <td valign='top' rowspan='1' colspan='1'>DOMEntity</td>
0106  * <td valign='top' rowspan='1' colspan='1'>entity name</td>
0107  * <td valign='top' rowspan='1' colspan='1'>null</td>
0108  * <td valign='top' rowspan='1' colspan='1'>null</td>
0109  * </tr>
0110  * <tr>
0111  * <td valign='top' rowspan='1' colspan='1'>DOMEntityReference</td>
0112  * <td valign='top' rowspan='1' colspan='1'>name of entity referenced</td>
0113  * <td valign='top' rowspan='1' colspan='1'>null</td>
0114  * <td valign='top' rowspan='1' colspan='1'>null</td>
0115  * </tr>
0116  * <tr>
0117  * <td valign='top' rowspan='1' colspan='1'>DOMNotation</td>
0118  * <td valign='top' rowspan='1' colspan='1'>notation name</td>
0119  * <td valign='top' rowspan='1' colspan='1'>null</td>
0120  * <td valign='top' rowspan='1' colspan='1'>null</td>
0121  * </tr>
0122  * <tr>
0123  * <td valign='top' rowspan='1' colspan='1'>DOMProcessingInstruction</td>
0124  * <td valign='top' rowspan='1' colspan='1'>target</td>
0125  * <td valign='top' rowspan='1' colspan='1'>entire content excluding the target</td>
0126  * <td valign='top' rowspan='1' colspan='1'>null</td>
0127  * </tr>
0128  * <tr>
0129  * <td valign='top' rowspan='1' colspan='1'>DOMText</td>
0130  * <td valign='top' rowspan='1' colspan='1'>&quot;\#text&quot;</td>
0131  * <td valign='top' rowspan='1' colspan='1'>content of the text node</td>
0132  * <td valign='top' rowspan='1' colspan='1'>null</td>
0133  * </tr>
0134  * </table>
0135  * <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>.
0136  *
0137  * @since DOM Level 1
0138  */
0139 class  CDOM_EXPORT DOMNode {
0140 protected:
0141     // -----------------------------------------------------------------------
0142     //  Hidden constructors
0143     // -----------------------------------------------------------------------
0144     /** @name Hidden constructors */
0145     //@{
0146     DOMNode() {}
0147     DOMNode(const DOMNode &) {}
0148     //@}
0149 
0150 private:
0151     // -----------------------------------------------------------------------
0152     // Unimplemented constructors and operators
0153     // -----------------------------------------------------------------------
0154     /** @name Unimplemented operators */
0155     //@{
0156     DOMNode & operator = (const DOMNode &);
0157     //@}
0158 
0159 public:
0160     // -----------------------------------------------------------------------
0161     //  All constructors are hidden, just the destructor is available
0162     // -----------------------------------------------------------------------
0163     /** @name Destructor */
0164     //@{
0165     /**
0166      * Destructor
0167      *
0168      */
0169     virtual ~DOMNode() {};
0170     //@}
0171 
0172     // -----------------------------------------------------------------------
0173     //  Class Types
0174     // -----------------------------------------------------------------------
0175     /** @name Public Constants */
0176     //@{
0177     /**
0178      * NodeType
0179      *
0180      * @since DOM Level 1
0181      */
0182     enum NodeType {
0183         ELEMENT_NODE                = 1,
0184         ATTRIBUTE_NODE              = 2,
0185         TEXT_NODE                   = 3,
0186         CDATA_SECTION_NODE          = 4,
0187         ENTITY_REFERENCE_NODE       = 5,
0188         ENTITY_NODE                 = 6,
0189         PROCESSING_INSTRUCTION_NODE = 7,
0190         COMMENT_NODE                = 8,
0191         DOCUMENT_NODE               = 9,
0192         DOCUMENT_TYPE_NODE          = 10,
0193         DOCUMENT_FRAGMENT_NODE      = 11,
0194         NOTATION_NODE               = 12
0195     };
0196 
0197     /**
0198      * DocumentPosition:
0199      *
0200      * <p><code>DOCUMENT_POSITION_CONTAINED_BY:</code>
0201      * The node is contained by the reference node. A node which is contained is always following, too.</p>
0202      * <p><code>DOCUMENT_POSITION_CONTAINS:</code>
0203      * The node contains the reference node. A node which contains is always preceding, too.</p>
0204      * <p><code>DOCUMENT_POSITION_DISCONNECTED:</code>
0205      * The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.</p>
0206      * <p><code>DOCUMENT_POSITION_FOLLOWING:</code>
0207      * The node follows the reference node.</p>
0208      * <p><code>DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:</code>
0209      * The determination of preceding versus following is implementation-specific.</p>
0210      * <p><code>DOCUMENT_POSITION_PRECEDING:</code>
0211      * The second node precedes the reference node.</p>
0212      *
0213      * @since DOM Level 3
0214      */
0215     enum DocumentPosition {
0216         DOCUMENT_POSITION_DISCONNECTED            = 0x01,
0217         DOCUMENT_POSITION_PRECEDING               = 0x02,
0218         DOCUMENT_POSITION_FOLLOWING               = 0x04,
0219         DOCUMENT_POSITION_CONTAINS                = 0x08,
0220         DOCUMENT_POSITION_CONTAINED_BY            = 0x10,
0221         DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
0222     };
0223     //@}
0224 
0225     // -----------------------------------------------------------------------
0226     //  Virtual DOMNode interface
0227     // -----------------------------------------------------------------------
0228     /** @name Functions introduced in DOM Level 1 */
0229     //@{
0230     // -----------------------------------------------------------------------
0231     //  Getter methods
0232     // -----------------------------------------------------------------------
0233     /**
0234      * The name of this node, depending on its type; see the table above.
0235      * @since DOM Level 1
0236      */
0237     virtual const XMLCh *   getNodeName() const = 0;
0238 
0239     /**
0240      * Gets the value of this node, depending on its type.
0241      *
0242      * @exception DOMException
0243      *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
0244      * @since DOM Level 1
0245      */
0246     virtual const XMLCh *       getNodeValue() const = 0;
0247 
0248     /**
0249      * An enum value representing the type of the underlying object.
0250      * @since DOM Level 1
0251      */
0252     virtual NodeType            getNodeType() const = 0;
0253 
0254     /**
0255      * Gets the parent of this node.
0256      *
0257      * All nodes, except <code>DOMDocument</code>,
0258      * <code>DOMDocumentFragment</code>, and <code>DOMAttr</code> may have a parent.
0259      * However, if a node has just been created and not yet added to the tree,
0260      * or if it has been removed from the tree, a <code>null</code> DOMNode
0261      * is returned.
0262      * @since DOM Level 1
0263      */
0264     virtual DOMNode        *getParentNode() const = 0;
0265 
0266     /**
0267      * Gets a <code>DOMNodeList</code> that contains all children of this node.
0268      *
0269      * If there
0270      * are no children, this is a <code>DOMNodeList</code> containing no nodes.
0271      * The content of the returned <code>DOMNodeList</code> is "live" in the sense
0272      * that, for instance, changes to the children of the node object that
0273      * it was created from are immediately reflected in the nodes returned by
0274      * the <code>DOMNodeList</code> accessors; it is not a static snapshot of the
0275      * content of the node. This is true for every <code>DOMNodeList</code>,
0276      * including the ones returned by the <code>getElementsByTagName</code>
0277      * method.
0278      * @since DOM Level 1
0279      */
0280     virtual DOMNodeList    *getChildNodes() const = 0;
0281     /**
0282      * Gets the first child of this node.
0283      *
0284      * If there is no such node, this returns <code>null</code>.
0285      * @since DOM Level 1
0286      */
0287     virtual DOMNode        *getFirstChild() const = 0;
0288 
0289     /**
0290      * Gets the last child of this node.
0291      *
0292      * If there is no such node, this returns <code>null</code>.
0293      * @since DOM Level 1
0294      */
0295     virtual DOMNode        *getLastChild() const = 0;
0296 
0297     /**
0298      * Gets the node immediately preceding this node.
0299      *
0300      * If there is no such node, this returns <code>null</code>.
0301      * @since DOM Level 1
0302      */
0303     virtual DOMNode        *getPreviousSibling() const = 0;
0304 
0305     /**
0306      * Gets the node immediately following this node.
0307      *
0308      * If there is no such node, this returns <code>null</code>.
0309      * @since DOM Level 1
0310      */
0311     virtual DOMNode        *getNextSibling() const = 0;
0312 
0313     /**
0314      * Gets a <code>DOMNamedNodeMap</code> containing the attributes of this node (if it
0315      * is an <code>DOMElement</code>) or <code>null</code> otherwise.
0316      * @since DOM Level 1
0317      */
0318     virtual DOMNamedNodeMap  *getAttributes() const = 0;
0319 
0320     /**
0321      * Gets the <code>DOMDocument</code> object associated with this node.
0322      *
0323      * This is also
0324      * the <code>DOMDocument</code> object used to create new nodes. When this
0325      * node is a <code>DOMDocument</code> or a <code>DOMDocumentType</code>
0326      * which is not used with any <code>DOMDocument</code> yet, this is
0327      * <code>null</code>.
0328      *
0329      * @since DOM Level 1
0330      */
0331     virtual DOMDocument      *getOwnerDocument() const = 0;
0332 
0333     // -----------------------------------------------------------------------
0334     //  Node methods
0335     // -----------------------------------------------------------------------
0336     /**
0337      * Returns a duplicate of this node.
0338      *
0339      * This function serves as a generic copy constructor for nodes.
0340      *
0341      * The duplicate node has no parent (
0342      * <code>parentNode</code> returns <code>null</code>.).
0343      * <br>Cloning an <code>DOMElement</code> copies all attributes and their
0344      * values, including those generated by the  XML processor to represent
0345      * defaulted attributes, but this method does not copy any text it contains
0346      * unless it is a deep clone, since the text is contained in a child
0347      * <code>DOMText</code> node. Cloning any other type of node simply returns a
0348      * copy of this node.
0349      * @param deep If <code>true</code>, recursively clone the subtree under the
0350      *   specified node; if <code>false</code>, clone only the node itself (and
0351      *   its attributes, if it is an <code>DOMElement</code>).
0352      * @return The duplicate node.
0353      * @since DOM Level 1
0354      */
0355     virtual DOMNode        * cloneNode(bool deep) const = 0;
0356 
0357     /**
0358      * Inserts the node <code>newChild</code> before the existing child node
0359      * <code>refChild</code>.
0360      *
0361      * If <code>refChild</code> is <code>null</code>,
0362      * insert <code>newChild</code> at the end of the list of children.
0363      * <br>If <code>newChild</code> is a <code>DOMDocumentFragment</code> object,
0364      * all of its children are inserted, in the same order, before
0365      * <code>refChild</code>. If the <code>newChild</code> is already in the
0366      * tree, it is first removed.  Note that a <code>DOMNode</code> that
0367      * has never been assigned to refer to an actual node is == null.
0368      * @param newChild The node to insert.
0369      * @param refChild The reference node, i.e., the node before which the new
0370      *   node must be inserted.
0371      * @return The node being inserted.
0372      * @exception DOMException
0373      *   HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
0374      *   allow children of the type of the <code>newChild</code> node, or if
0375      *   the node to insert is one of this node's ancestors.
0376      *   <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
0377      *   from a different document than the one that created this node.
0378      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
0379      *   inserted is readonly.
0380      *   <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of
0381      *   this node.
0382      * @since DOM Level 1
0383      */
0384     virtual DOMNode       *insertBefore(DOMNode *newChild,
0385                                           DOMNode *refChild) = 0;
0386 
0387 
0388     /**
0389      * Replaces the child node <code>oldChild</code> with <code>newChild</code>
0390      * in the list of children, and returns the <code>oldChild</code> node.
0391      *
0392      * If <CODE>newChild</CODE> is a <CODE>DOMDocumentFragment</CODE> object,
0393      * <CODE>oldChild</CODE> is replaced by all of the <CODE>DOMDocumentFragment</CODE>
0394      * children, which are inserted in the same order.
0395      *
0396      * If the <code>newChild</code> is already in the tree, it is first removed.
0397      * @param newChild The new node to put in the child list.
0398      * @param oldChild The node being replaced in the list.
0399      * @return The node replaced.
0400      * @exception DOMException
0401      *   HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
0402      *   allow children of the type of the <code>newChild</code> node, or it
0403      *   the node to put in is one of this node's ancestors.
0404      *   <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
0405      *   from a different document than the one that created this node.
0406      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the new node is readonly.
0407      *   <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
0408      *   this node.
0409      * @since DOM Level 1
0410      */
0411     virtual DOMNode  *replaceChild(DOMNode *newChild,
0412                                      DOMNode *oldChild) = 0;
0413     /**
0414      * Removes the child node indicated by <code>oldChild</code> from the list
0415      * of children, and returns it.
0416      *
0417      * @param oldChild The node being removed.
0418      * @return The node removed.
0419      * @exception DOMException
0420      *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
0421      *   <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
0422      *   this node.
0423      * @since DOM Level 1
0424      */
0425     virtual DOMNode        *removeChild(DOMNode *oldChild) = 0;
0426 
0427     /**
0428      * Adds the node <code>newChild</code> to the end of the list of children of
0429      * this node.
0430      *
0431      * If the <code>newChild</code> is already in the tree, it is
0432      * first removed.
0433      * @param newChild The node to add.If it is a  <code>DOMDocumentFragment</code>
0434      *   object, the entire contents of the document fragment are moved into
0435      *   the child list of this node
0436      * @return The node added.
0437      * @exception DOMException
0438      *   HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
0439      *   allow children of the type of the <code>newChild</code> node, or if
0440      *   the node to append is one of this node's ancestors.
0441      *   <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
0442      *   from a different document than the one that created this node.
0443      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
0444      *   appended is readonly.
0445      * @since DOM Level 1
0446      */
0447     virtual DOMNode        *appendChild(DOMNode *newChild) = 0;
0448 
0449     // -----------------------------------------------------------------------
0450     //  Query methods
0451     // -----------------------------------------------------------------------
0452     /**
0453      *  This is a convenience method to allow easy determination of whether a
0454      * node has any children.
0455      *
0456      * @return  <code>true</code> if the node has any children,
0457      *   <code>false</code> if the node has no children.
0458      * @since DOM Level 1
0459      */
0460     virtual bool             hasChildNodes() const = 0;
0461 
0462     // -----------------------------------------------------------------------
0463     //  Setter methods
0464     // -----------------------------------------------------------------------
0465     /**
0466      * Sets the value of the node.
0467      *
0468      * Any node which can have a nodeValue will
0469      * also accept requests to set it to a string. The exact response to
0470      * this varies from node to node -- Attribute, for example, stores
0471      * its values in its children and has to replace them with a new Text
0472      * holding the replacement value.
0473      *
0474      * For most types of Node, value is null and attempting to set it
0475      * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
0476      * also be thrown if the node is read-only.
0477      * @see #getNodeValue
0478      * @since DOM Level 1
0479      */
0480     virtual void              setNodeValue(const XMLCh  *nodeValue) = 0;
0481     //@}
0482 
0483     /** @name Functions introduced in DOM Level 2. */
0484     //@{
0485     /**
0486      * Puts all <CODE>DOMText</CODE>
0487      * nodes in the full depth of the sub-tree underneath this <CODE>DOMNode</CODE>,
0488      * including attribute nodes, into a "normal" form where only markup (e.g.,
0489      * tags, comments, processing instructions, CDATA sections, and entity
0490      * references) separates <CODE>DOMText</CODE>
0491      * nodes, i.e., there are neither adjacent <CODE>DOMText</CODE>
0492      * nodes nor empty <CODE>DOMText</CODE>
0493      * nodes. This can be used to ensure that the DOM view of a document is the
0494      * same as if it were saved and re-loaded, and is useful when operations
0495      * (such as XPointer lookups) that depend on a particular document tree
0496      * structure are to be used.
0497      * <P><B>Note:</B> In cases where the document contains <CODE>DOMCDATASections</CODE>,
0498      * the normalize operation alone may not be sufficient, since XPointers do
0499      * not differentiate between <CODE>DOMText</CODE>
0500      * nodes and <CODE>DOMCDATASection</CODE>
0501      * nodes.</P>
0502      *
0503      * @since DOM Level 2
0504      */
0505     virtual void              normalize() = 0;
0506 
0507     /**
0508      * Tests whether the DOM implementation implements a specific
0509      * feature and that feature is supported by this node.
0510      *
0511      * @param feature The string of the feature to test. This is the same
0512      * name as what can be passed to the method <code>hasFeature</code> on
0513      * <code>DOMImplementation</code>.
0514      * @param version This is the version number of the feature to test. In
0515      * Level 2, version 1, this is the string "2.0". If the version is not
0516      * specified, supporting any version of the feature will cause the
0517      * method to return <code>true</code>.
0518      * @return Returns <code>true</code> if the specified feature is supported
0519      * on this node, <code>false</code> otherwise.
0520      * @since DOM Level 2
0521      */
0522     virtual bool              isSupported(const XMLCh *feature,
0523                                            const XMLCh *version) const = 0;
0524 
0525     /**
0526      * Get the <em>namespace URI</em> of
0527      * this node, or <code>null</code> if it is unspecified.
0528      * <p>
0529      * This is not a computed value that is the result of a namespace lookup
0530      * based on an examination of the namespace declarations in scope. It is
0531      * merely the namespace URI given at creation time.
0532      * <p>
0533      * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
0534      * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
0535      * such as <CODE>createElement</CODE> from the <CODE>DOMDocument</CODE>
0536      * interface, this is always <CODE>null</CODE>.
0537      *
0538      * @since DOM Level 2
0539      */
0540     virtual const XMLCh *         getNamespaceURI() const = 0;
0541 
0542     /**
0543      * Get the <em>namespace prefix</em>
0544      * of this node, or <code>null</code> if it is unspecified.
0545      *
0546      * @since DOM Level 2
0547      */
0548     virtual const XMLCh *          getPrefix() const = 0;
0549 
0550     /**
0551      * Returns the local part of the <em>qualified name</em> of this node.
0552      * <p>
0553      * For nodes created with a DOM Level 1 method, such as
0554      * <code>createElement</code> from the <code>DOMDocument</code> interface,
0555      * it is null.
0556      *
0557      * @since DOM Level 2
0558      */
0559     virtual const XMLCh *          getLocalName() const = 0;
0560 
0561     /**
0562      * Set the <em>namespace prefix</em> of this node.
0563      * <p>
0564      * Note that setting this attribute, when permitted, changes
0565      * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
0566      * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
0567      * attributes of the <CODE>DOMElement</CODE> and <CODE>DOMAttr</CODE>
0568      * interfaces, when applicable.
0569      * <p>
0570      * Note also that changing the prefix of an
0571      * attribute, that is known to have a default value, does not make a new
0572      * attribute with the default value and the original prefix appear, since the
0573      * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
0574      *
0575      *
0576      * @param prefix The prefix of this node.
0577      * @exception DOMException
0578      *   INVALID_CHARACTER_ERR: Raised if the specified prefix contains
0579      *                          an illegal character.
0580      * <br>
0581      *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
0582      * <br>
0583      *   NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
0584      *      malformed, if the <CODE>namespaceURI</CODE> of this node is
0585      *      <CODE>null</CODE>, if the specified prefix is "xml" and the
0586      *      <CODE>namespaceURI</CODE> of this node is different from
0587      *      "http://www.w3.org/XML/1998/namespace", if this node is an attribute
0588      *      and the specified prefix is "xmlns" and the
0589      *      <CODE>namespaceURI</CODE> of this node is different from
0590      *      "http://www.w3.org/2000/xmlns/", or if this node is an attribute and
0591      *      the <CODE>qualifiedName</CODE> of this node is "xmlns".
0592      * @since DOM Level 2
0593      */
0594     virtual void              setPrefix(const XMLCh * prefix) = 0;
0595 
0596     /**
0597      *  Returns whether this node (if it is an element) has any attributes.
0598      * @return <code>true</code> if this node has any attributes,
0599      *   <code>false</code> otherwise.
0600      * @since DOM Level 2
0601      */
0602     virtual bool              hasAttributes() const = 0;
0603     //@}
0604 
0605     /** @name Functions introduced in DOM Level 3. */
0606     //@{
0607     /**
0608      * Returns whether this node is the same node as the given one.
0609      * <br>This method provides a way to determine whether two
0610      * <code>DOMNode</code> references returned by the implementation reference
0611      * the same object. When two <code>DOMNode</code> references are references
0612      * to the same object, even if through a proxy, the references may be
0613      * used completely interchangeably, such that all attributes have the
0614      * same values and calling the same DOM method on either reference
0615      * always has exactly the same effect.
0616      *
0617      * @param other The node to test against.
0618      * @return Returns <code>true</code> if the nodes are the same,
0619      *   <code>false</code> otherwise.
0620      * @since DOM Level 3
0621      */
0622     virtual bool              isSameNode(const DOMNode* other) const = 0;
0623 
0624     /**
0625      * Tests whether two nodes are equal.
0626      * <br>This method tests for equality of nodes, not sameness (i.e.,
0627      * whether the two nodes are pointers to the same object) which can be
0628      * tested with <code>DOMNode::isSameNode</code>. All nodes that are the same
0629      * will also be equal, though the reverse may not be true.
0630      * <br>Two nodes are equal if and only if the following conditions are
0631      * satisfied: The two nodes are of the same type.The following string
0632      * attributes are equal: <code>nodeName</code>, <code>localName</code>,
0633      * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
0634      * , <code>baseURI</code>. This is: they are both <code>null</code>, or
0635      * they have the same length and are character for character identical.
0636      * The <code>attributes</code> <code>DOMNamedNodeMaps</code> are equal.
0637      * This is: they are both <code>null</code>, or they have the same
0638      * length and for each node that exists in one map there is a node that
0639      * exists in the other map and is equal, although not necessarily at the
0640      * same index.The <code>childNodes</code> <code>DOMNodeLists</code> are
0641      * equal. This is: they are both <code>null</code>, or they have the
0642      * same length and contain equal nodes at the same index. This is true
0643      * for <code>DOMAttr</code> nodes as for any other type of node. Note that
0644      * normalization can affect equality; to avoid this, nodes should be
0645      * normalized before being compared.
0646      * <br>For two <code>DOMDocumentType</code> nodes to be equal, the following
0647      * conditions must also be satisfied: The following string attributes
0648      * are equal: <code>publicId</code>, <code>systemId</code>,
0649      * <code>internalSubset</code>.The <code>entities</code>
0650      * <code>DOMNamedNodeMaps</code> are equal.The <code>notations</code>
0651      * <code>DOMNamedNodeMaps</code> are equal.
0652      * <br>On the other hand, the following do not affect equality: the
0653      * <code>ownerDocument</code> attribute, the <code>specified</code>
0654      * attribute for <code>DOMAttr</code> nodes, the
0655      * <code>isWhitespaceInElementContent</code> attribute for
0656      * <code>DOMText</code> nodes, as well as any user data or event listeners
0657      * registered on the nodes.
0658      *
0659      * @param arg The node to compare equality with.
0660      * @return If the nodes, and possibly subtrees are equal,
0661      *   <code>true</code> otherwise <code>false</code>.
0662      * @since DOM Level 3
0663      */
0664     virtual bool              isEqualNode(const DOMNode* arg) const = 0;
0665 
0666 
0667     /**
0668      * Associate an object to a key on this node. The object can later be
0669      * retrieved from this node by calling <code>getUserData</code> with the
0670      * same key.
0671      *
0672      * Deletion of the user data remains the responsibility of the
0673      * application program; it will not be automatically deleted when
0674      * the nodes themselves are reclaimed.
0675      *
0676      * Both the parameter <code>data</code> and the returned object are
0677      * void pointer, it is applications' responsibility to keep track of
0678      * their original type.  Casting them to the wrong type may result
0679      * unexpected behavior.
0680      *
0681      * @param key The key to associate the object to.
0682      * @param data The object to associate to the given key, or
0683      *   <code>null</code> to remove any existing association to that key.
0684      * @param handler The handler to associate to that key, or
0685      *   <code>null</code>.
0686      * @return Returns the void* object previously associated to
0687      *   the given key on this node, or <code>null</code> if there was none.
0688      * @see #getUserData
0689      *
0690      * @since DOM Level 3
0691      */
0692     virtual void*             setUserData(const XMLCh* key,
0693                                           void* data,
0694                                           DOMUserDataHandler* handler) = 0;
0695 
0696     /**
0697      * Retrieves the object associated to a key on a this node. The object
0698      * must first have been set to this node by calling
0699      * <code>setUserData</code> with the same key.
0700      *
0701      * @param key The key the object is associated to.
0702      * @return Returns the <code>void*</code> associated to the given key
0703      *   on this node, or <code>null</code> if there was none.
0704      * @see #setUserData
0705      * @since DOM Level 3
0706      */
0707     virtual void*             getUserData(const XMLCh* key) const = 0;
0708 
0709 
0710     /**
0711      * The absolute base URI of this node or <code>null</code> if undefined.
0712      * This value is computed according to . However, when the
0713      * <code>DOMDocument</code> supports the feature "HTML" , the base URI is
0714      * computed using first the value of the href attribute of the HTML BASE
0715      * element if any, and the value of the <code>documentURI</code>
0716      * attribute from the <code>DOMDocument</code> interface otherwise.
0717      *
0718      * <br> When the node is an <code>DOMElement</code>, a <code>DOMDocument</code>
0719      * or a a <code>DOMProcessingInstruction</code>, this attribute represents
0720      * the properties [base URI] defined in . When the node is a
0721      * <code>DOMNotation</code>, an <code>DOMEntity</code>, or an
0722      * <code>DOMEntityReference</code>, this attribute represents the
0723      * properties [declaration base URI].
0724      * @since DOM Level 3
0725      */
0726     virtual const XMLCh*      getBaseURI() const = 0;
0727 
0728     /**
0729      * Compares the reference node, i.e. the node on which this method is being called,
0730      * with a node, i.e. the one passed as a parameter, with regard to their position
0731      * in the document and according to the document order.
0732      *
0733      * @param other The node to compare against this node.
0734      * @return Returns how the given node is positioned relatively to this
0735      *   node.
0736      * @since DOM Level 3
0737      */
0738     virtual short             compareDocumentPosition(const DOMNode* other) const = 0;
0739 
0740     /**
0741      * <strong>WARNING:</strong> This method is known to be buggy and does
0742      * not produce accurate results under a variety of conditions.
0743      *
0744      * <br>This attribute returns the text content of this node and its
0745      * descendants. No serialization is performed, the returned string
0746      * does not contain any markup. No whitespace normalization is
0747      * performed and the returned string does not contain the white
0748      * spaces in element content.
0749      *
0750      * <br>The string returned is made of the text content of this node
0751      * depending on its type, as defined below:
0752      * <table border='1'>
0753      * <tr>
0754      * <td>Node type</td>
0755      * <td>Content</td>
0756      * </tr>
0757      * <tr>
0758      * <td valign='top' rowspan='1' colspan='1'>
0759      * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
0760      * DOCUMENT_FRAGMENT_NODE</td>
0761      * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
0762      * attribute value of every child node, excluding COMMENT_NODE and
0763      * PROCESSING_INSTRUCTION_NODE nodes</td>
0764      * </tr>
0765      * <tr>
0766      * <td valign='top' rowspan='1' colspan='1'>ATTRIBUTE_NODE, TEXT_NODE,
0767      * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td>
0768      * <td valign='top' rowspan='1' colspan='1'>
0769      * <code>nodeValue</code></td>
0770      * </tr>
0771      * <tr>
0772      * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
0773      * <td valign='top' rowspan='1' colspan='1'>
0774      * null</td>
0775      * </tr>
0776      * </table>
0777      * @exception DOMException
0778      *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
0779      *   fit in a <code>DOMString</code> variable on the implementation
0780      *   platform.
0781      * @see #setTextContent
0782      * @since DOM Level 3
0783      */
0784     virtual const XMLCh*      getTextContent() const = 0;
0785 
0786     /**
0787      * This attribute removes any possible children this node may have and, if the
0788      * new string is not empty or null, replaced by a single <code>DOMText</code>
0789      * node containing the string this attribute is set to. No parsing is
0790      * performed, the input string is taken as pure textual content.
0791      *
0792      * @exception DOMException
0793      *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
0794      * @see #getTextContent
0795      * @since DOM Level 3
0796      */
0797     virtual void              setTextContent(const XMLCh* textContent) = 0;
0798 
0799     /**
0800      * Look up the prefix associated to the given namespace URI, starting from this node.
0801      * The default namespace declarations are ignored by this method.
0802      *
0803      * @param namespaceURI The namespace URI to look for.
0804      * @return Returns an associated namespace prefix if found,
0805      *   <code>null</code> if none is found. If more
0806      *   than one prefix are associated to the namespace prefix, the
0807      *   returned namespace prefix is implementation dependent.
0808      * @since DOM Level 3
0809      */
0810     virtual const XMLCh*      lookupPrefix(const XMLCh* namespaceURI) const = 0;
0811 
0812     /**
0813      * This method checks if the specified <code>namespaceURI</code> is the
0814      * default namespace or not.
0815      *
0816      * @param namespaceURI The namespace URI to look for.
0817      * @return  <code>true</code> if the specified <code>namespaceURI</code>
0818      *   is the default namespace, <code>false</code> otherwise.
0819      * @since DOM Level 3
0820      */
0821     virtual bool              isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
0822 
0823     /**
0824      * Look up the namespace URI associated to the given prefix, starting from
0825      * this node.
0826      *
0827      * @param prefix The prefix to look for. If this parameter is
0828      *   <code>null</code>, the method will return the default namespace URI
0829      *   if any.
0830      * @return Returns the associated namespace URI or <code>null</code> if
0831      *   none is found.
0832      * @since DOM Level 3
0833      */
0834     virtual const XMLCh*      lookupNamespaceURI(const XMLCh* prefix) const  = 0;
0835 
0836     /**
0837      * This method makes available a <code>DOMNode</code>'s specialized interface
0838      *
0839      * @param feature The name of the feature requested (case-insensitive).
0840      * @param version The version of the feature requested.
0841      * @return Returns an alternate <code>DOMNode</code> which implements the
0842      *   specialized APIs of the specified feature, if any, or
0843      *   <code>null</code> if there is no alternate <code>DOMNode</code> which
0844      *   implements interfaces associated with that feature. Any alternate
0845      *   <code>DOMNode</code> returned by this method must delegate to the
0846      *   primary core <code>DOMNode</code> and not return results inconsistent
0847      *   with the primary core <code>DOMNode</code> such as <code>key</code>,
0848      *   <code>attributes</code>, <code>childNodes</code>, etc.
0849      * @since DOM Level 3
0850      */
0851     virtual void*             getFeature(const XMLCh* feature, const XMLCh* version) const = 0;
0852     //@}
0853 
0854     // -----------------------------------------------------------------------
0855     //  Non-standard Extension
0856     // -----------------------------------------------------------------------
0857     /** @name Non-standard Extension */
0858     //@{
0859     /**
0860      * Called to indicate that this Node (and its associated children) is no longer in use
0861      * and that the implementation may relinquish any resources associated with it and
0862      * its associated children.
0863      *
0864      * If this is a document, any nodes it owns (created by DOMDocument::createXXXX())
0865      * are also released.
0866      *
0867      * Access to a released object will lead to unexpected result.
0868      *
0869      * @exception DOMException
0870      *   INVALID_ACCESS_ERR: Raised if this Node has a parent and thus should not be released yet.
0871      */
0872     virtual void              release() = 0;
0873     //@}
0874 #if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
0875     // -----------------------------------------------------------------------
0876     //  Non-standard Extension
0877     // -----------------------------------------------------------------------
0878     /** @name Non-standard Extension */
0879     //@{
0880     /**
0881      * This is custom function which can be implemented by classes deriving
0882      * from DOMNode for implementing reference counting on DOMNodes. Any
0883      * implementation which has memory management model which involves
0884      * disposing of nodes immediately after being used can override this
0885      * function to do that job.
0886      */
0887     virtual void decRefCount() {}
0888     //@}
0889 
0890     // -----------------------------------------------------------------------
0891     //  Non-standard Extension
0892     // -----------------------------------------------------------------------
0893     /** @name Non-standard Extension */
0894     //@{
0895     /**
0896      * This is custom function which can be implemented by classes deriving
0897      * from DOMNode for implementing reference counting on DOMNodes.
0898      */
0899     virtual void incRefCount() {}
0900     //@}
0901 #endif
0902 };
0903 
0904 /***
0905  * Utilities macros for getting memory manager within DOM
0906 ***/
0907 #define GET_OWNER_DOCUMENT(ptr)      \
0908         ((DOMDocumentImpl*)(ptr->getOwnerDocument()))
0909 
0910 #define GET_DIRECT_MM(ptr)           \
0911         (ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager)
0912 
0913 #define GET_INDIRECT_MM(ptr)                                                    \
0914         (!ptr ? XMLPlatformUtils::fgMemoryManager :                              \
0915         GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
0916         XMLPlatformUtils::fgMemoryManager)
0917 
0918 /***
0919  * For DOMNode and its derivatives
0920 ***/
0921 #define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
0922 
0923 XERCES_CPP_NAMESPACE_END
0924 
0925 #endif