Xerces-C++: DOMNode.hpp Source File

| API Docs for SAX and DOM |
| Main Page Classes Files Related Pages # DOMNode.hpp Go to the documentation of this file.
    00001 #ifndef DOMNode_HEADER_GUARD_
    00002 #define DOMNode_HEADER_GUARD_
    00003
    00004 /*
    00005  * Licensed to the Apache Software Foundation (ASF) under one or more
    00006  * contributor license agreements.  See the NOTICE file distributed with
    00007  * this work for additional information regarding copyright ownership.
    00008  * The ASF licenses this file to You under the Apache License, Version 2.0
    00009  * (the "License"); you may not use this file except in compliance with
    00010  * the License.  You may obtain a copy of the License at
    00011  *
    00012  *      http://www.apache.org/licenses/LICENSE-2.0
    00013  *
    00014  * Unless required by applicable law or agreed to in writing, software
    00015  * distributed under the License is distributed on an "AS IS" BASIS,
    00016  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00017  * See the License for the specific language governing permissions and
    00018  * limitations under the License.
    00019  */
    00020
    00021 /*
    00022  * $Id: DOMNode.hpp 568078 2007-08-21 11:43:25Z amassari $
    00023  */
    00024
    00025 #include <xercesc/util/XercesDefs.hpp>
    00026
    00027 XERCES_CPP_NAMESPACE_BEGIN
    00028
    00029
    00030 class DOMDocument;
    00031 class DOMNamedNodeMap;
    00032 class DOMNodeList;
    00033 class DOMUserDataHandler;
    00034
    00139 class   DOMNode {
    00140 protected:
    00141     // -----------------------------------------------------------------------
    00142     //  Hidden constructors
    00143     // -----------------------------------------------------------------------
    00146     DOMNode() {}
    00147     DOMNode(const DOMNode &) {}
    00149
    00150 private:
    00151     // -----------------------------------------------------------------------
    00152     // Unimplemented constructors and operators
    00153     // -----------------------------------------------------------------------
    00156     DOMNode & operator = (const DOMNode &);
    00158
    00159 public:
    00160     // -----------------------------------------------------------------------
    00161     //  All constructors are hidden, just the destructor is available
    00162     // -----------------------------------------------------------------------
    00169     virtual ~DOMNode() {};
    00171
    00172     // -----------------------------------------------------------------------
    00173     //  Class Types
    00174     // -----------------------------------------------------------------------
    00182     enum NodeType {
    00183         ELEMENT_NODE                = 1,
    00184         ATTRIBUTE_NODE              = 2,
    00185         TEXT_NODE                   = 3,
    00186         CDATA_SECTION_NODE          = 4,
    00187         ENTITY_REFERENCE_NODE       = 5,
    00188         ENTITY_NODE                 = 6,
    00189         PROCESSING_INSTRUCTION_NODE = 7,
    00190         COMMENT_NODE                = 8,
    00191         DOCUMENT_NODE               = 9,
    00192         DOCUMENT_TYPE_NODE          = 10,
    00193         DOCUMENT_FRAGMENT_NODE      = 11,
    00194         NOTATION_NODE               = 12
    00195     };
    00196
    00223     enum DOMTreePosition {
    00224         TREE_POSITION_PRECEDING   = 0x01,
    00225         TREE_POSITION_FOLLOWING   = 0x02,
    00226         TREE_POSITION_ANCESTOR    = 0x04,
    00227         TREE_POSITION_DESCENDANT  = 0x08,
    00228         TREE_POSITION_EQUIVALENT  = 0x10,
    00229         TREE_POSITION_SAME_NODE   = 0x20,
    00230         TREE_POSITION_DISCONNECTED = 0x00
    00231     };
    00233
    00234     // -----------------------------------------------------------------------
    00235     //  Virtual DOMNode interface
    00236     // -----------------------------------------------------------------------
    00239     // -----------------------------------------------------------------------
    00240     //  Getter methods
    00241     // -----------------------------------------------------------------------
    00246     virtual const XMLCh *   getNodeName() const = 0;
    00247
    00255     virtual const XMLCh *       getNodeValue() const = 0;
    00256
    00261     virtual short           getNodeType() const = 0;
    00262
    00273     virtual DOMNode        *getParentNode() const = 0;
    00274
    00289     virtual DOMNodeList    *getChildNodes() const = 0;
    00296     virtual DOMNode        *getFirstChild() const = 0;
    00297
    00304     virtual DOMNode        *getLastChild() const = 0;
    00305
    00312     virtual DOMNode        *getPreviousSibling() const = 0;
    00313
    00320     virtual DOMNode        *getNextSibling() const = 0;
    00321
    00327     virtual DOMNamedNodeMap  *getAttributes() const = 0;
    00328
    00340     virtual DOMDocument      *getOwnerDocument() const = 0;
    00341
    00342     // -----------------------------------------------------------------------
    00343     //  Node methods
    00344     // -----------------------------------------------------------------------
    00364     virtual DOMNode        * cloneNode(bool deep) const = 0;
    00365
    00393     virtual DOMNode       *insertBefore(DOMNode *newChild,
    00394                                           DOMNode *refChild) = 0;
    00395
    00396
    00420     virtual DOMNode  *replaceChild(DOMNode *newChild,
    00421                                      DOMNode *oldChild) = 0;
    00434     virtual DOMNode        *removeChild(DOMNode *oldChild) = 0;
    00435
    00456     virtual DOMNode        *appendChild(DOMNode *newChild) = 0;
    00457
    00458     // -----------------------------------------------------------------------
    00459     //  Query methods
    00460     // -----------------------------------------------------------------------
    00469     virtual bool             hasChildNodes() const = 0;
    00470
    00471     // -----------------------------------------------------------------------
    00472     //  Setter methods
    00473     // -----------------------------------------------------------------------
    00489     virtual void              setNodeValue(const XMLCh  *nodeValue) = 0;
    00491
    00514     virtual void              normalize() = 0;
    00515
    00531     virtual bool              isSupported(const XMLCh *feature,
    00532                                            const XMLCh *version) const = 0;
    00533
    00549     virtual const XMLCh *         getNamespaceURI() const = 0;
    00550
    00557     virtual const XMLCh *          getPrefix() const = 0;
    00558
    00568     virtual const XMLCh *          getLocalName() const = 0;
    00569
    00603     virtual void              setPrefix(const XMLCh * prefix) = 0;
    00604
    00611     virtual bool              hasAttributes() const = 0;
    00613
    00633     virtual bool              isSameNode(const DOMNode* other) const = 0;
    00634
    00677     virtual bool              isEqualNode(const DOMNode* arg) const = 0;
    00678
    00679
    00707     virtual void*             setUserData(const XMLCh* key,
    00708                                           void* data,
    00709                                           DOMUserDataHandler* handler) = 0;
    00710
    00724     virtual void*             getUserData(const XMLCh* key) const = 0;
    00725
    00726
    00745     virtual const XMLCh*           getBaseURI() const = 0;
    00746
    00759     virtual short                  compareTreePosition(const DOMNode* other) const = 0;
    00760
    00804     virtual const XMLCh*           getTextContent() const = 0;
    00805
    00819     virtual void                   setTextContent(const XMLCh* textContent) = 0;
    00820
    00838     virtual const XMLCh*           lookupNamespacePrefix(const XMLCh* namespaceURI,
    00839                                                          bool useDefault) const = 0;
    00840
    00852     virtual bool                   isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
    00853
    00867     virtual const XMLCh*           lookupNamespaceURI(const XMLCh* prefix) const  = 0;
    00868
    00885     virtual DOMNode*               getInterface(const XMLCh* feature) = 0;
    00887
    00888     // -----------------------------------------------------------------------
    00889     //  Non-standard Extension
    00890     // -----------------------------------------------------------------------
    00906     virtual void              release() = 0;
    00908 #if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
    00909     // -----------------------------------------------------------------------
    00910     //  Non-standard Extension
    00911     // -----------------------------------------------------------------------
    00921     virtual void decRefCount() {}
    00923
    00924     // -----------------------------------------------------------------------
    00925     //  Non-standard Extension
    00926     // -----------------------------------------------------------------------
    00933     virtual void incRefCount() {}
    00935 #endif
    00936 };
    00937
    00938 /***
    00939  * Utilities macros for getting memory manager within DOM
    00940 ***/
    00941 #define GET_OWNER_DOCUMENT(ptr)      \
    00942         ((DOMDocumentImpl*)(ptr->getOwnerDocument()))
    00943
    00944 #define GET_DIRECT_MM(ptr)           \
    00945         ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager
    00946
    00947 #define GET_INDIRECT_MM(ptr)                                                    \
    00948         !ptr ? XMLPlatformUtils::fgMemoryManager :                              \
    00949         GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
    00950         XMLPlatformUtils::fgMemoryManager
    00951
    00952 /***
    00953  * For DOMNode and its derivatives
    00954 ***/
    00955 #define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
    00956
    00957 XERCES_CPP_NAMESPACE_END
    00958
    00959 #endif
    00960

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.