DOMNode.hpp

Go to the documentation of this file.
00001 #ifndef DOMNode_HEADER_GUARD_
00002 #define DOMNode_HEADER_GUARD_
00003 
00004 /*
00005  * Copyright 2001-2002,2004 The Apache Software Foundation.
00006  * 
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  * 
00011  *      http://www.apache.org/licenses/LICENSE-2.0
00012  * 
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019 
00020 /*
00021  * $Id: DOMNode.hpp 176294 2005-01-20 17:36:18Z cargilld $
00022  */
00023 
00024 #include <xercesc/util/XercesDefs.hpp>
00025 
00026 XERCES_CPP_NAMESPACE_BEGIN
00027 
00028 
00029 class DOMDocument;
00030 class DOMNamedNodeMap;
00031 class DOMNodeList;
00032 class DOMUserDataHandler;
00033 
00138 class  CDOM_EXPORT DOMNode {
00139 protected:
00140     // -----------------------------------------------------------------------
00141     //  Hidden constructors
00142     // -----------------------------------------------------------------------
00145     DOMNode() {}
00146     DOMNode(const DOMNode &) {}
00148 
00149 private:    
00150     // -----------------------------------------------------------------------
00151     // Unimplemented constructors and operators
00152     // -----------------------------------------------------------------------
00155     DOMNode & operator = (const DOMNode &);
00157 
00158 public:
00159     // -----------------------------------------------------------------------
00160     //  All constructors are hidden, just the destructor is available
00161     // -----------------------------------------------------------------------
00168     virtual ~DOMNode() {};
00170 
00171     // -----------------------------------------------------------------------
00172     //  Class Types
00173     // -----------------------------------------------------------------------
00181     enum NodeType {
00182         ELEMENT_NODE                = 1,
00183         ATTRIBUTE_NODE              = 2,
00184         TEXT_NODE                   = 3,
00185         CDATA_SECTION_NODE          = 4,
00186         ENTITY_REFERENCE_NODE       = 5,
00187         ENTITY_NODE                 = 6,
00188         PROCESSING_INSTRUCTION_NODE = 7,
00189         COMMENT_NODE                = 8,
00190         DOCUMENT_NODE               = 9,
00191         DOCUMENT_TYPE_NODE          = 10,
00192         DOCUMENT_FRAGMENT_NODE      = 11,
00193         NOTATION_NODE               = 12
00194     };
00195 
00222     enum DOMTreePosition {
00223         TREE_POSITION_PRECEDING   = 0x01,
00224         TREE_POSITION_FOLLOWING   = 0x02,
00225         TREE_POSITION_ANCESTOR    = 0x04,
00226         TREE_POSITION_DESCENDANT  = 0x08,
00227         TREE_POSITION_EQUIVALENT  = 0x10,
00228         TREE_POSITION_SAME_NODE   = 0x20,
00229         TREE_POSITION_DISCONNECTED = 0x00
00230     };
00232 
00233     // -----------------------------------------------------------------------
00234     //  Virtual DOMNode interface
00235     // -----------------------------------------------------------------------
00238     // -----------------------------------------------------------------------
00239     //  Getter methods
00240     // -----------------------------------------------------------------------
00245     virtual const XMLCh *   getNodeName() const = 0;
00246 
00254     virtual const XMLCh *       getNodeValue() const = 0;
00255 
00260     virtual short           getNodeType() const = 0;
00261 
00272     virtual DOMNode        *getParentNode() const = 0;
00273 
00288     virtual DOMNodeList    *getChildNodes() const = 0;
00295     virtual DOMNode        *getFirstChild() const = 0;
00296 
00303     virtual DOMNode        *getLastChild() const = 0;
00304 
00311     virtual DOMNode        *getPreviousSibling() const = 0;
00312 
00319     virtual DOMNode        *getNextSibling() const = 0;
00320 
00326     virtual DOMNamedNodeMap  *getAttributes() const = 0;
00327 
00339     virtual DOMDocument      *getOwnerDocument() const = 0;
00340 
00341     // -----------------------------------------------------------------------
00342     //  Node methods
00343     // -----------------------------------------------------------------------
00363     virtual DOMNode        * cloneNode(bool deep) const = 0;
00364 
00392     virtual DOMNode       *insertBefore(DOMNode *newChild,
00393                                           DOMNode *refChild) = 0;
00394 
00395 
00419     virtual DOMNode  *replaceChild(DOMNode *newChild,
00420                                      DOMNode *oldChild) = 0;
00433     virtual DOMNode        *removeChild(DOMNode *oldChild) = 0;
00434 
00455     virtual DOMNode        *appendChild(DOMNode *newChild) = 0;
00456 
00457     // -----------------------------------------------------------------------
00458     //  Query methods
00459     // -----------------------------------------------------------------------
00468     virtual bool             hasChildNodes() const = 0;
00469 
00470     // -----------------------------------------------------------------------
00471     //  Setter methods
00472     // -----------------------------------------------------------------------
00488     virtual void              setNodeValue(const XMLCh  *nodeValue) = 0;
00490 
00513     virtual void              normalize() = 0;
00514 
00530     virtual bool              isSupported(const XMLCh *feature,
00531                                                const XMLCh *version) const = 0;
00532 
00548     virtual const XMLCh *         getNamespaceURI() const = 0;
00549 
00556     virtual const XMLCh *          getPrefix() const = 0;
00557 
00567     virtual const XMLCh *          getLocalName() const = 0;
00568 
00602     virtual void              setPrefix(const XMLCh * prefix) = 0;
00603 
00610     virtual bool              hasAttributes() const = 0;
00612 
00632     virtual bool              isSameNode(const DOMNode* other) const = 0;
00633 
00676     virtual bool              isEqualNode(const DOMNode* arg) const = 0;
00677 
00678 
00706     virtual void*             setUserData(const XMLCh* key,
00707                                           void* data,
00708                                           DOMUserDataHandler* handler) = 0;
00709 
00723     virtual void*             getUserData(const XMLCh* key) const = 0;
00724 
00725 
00744     virtual const XMLCh*           getBaseURI() const = 0;
00745 
00758     virtual short                  compareTreePosition(const DOMNode* other) const = 0;
00759 
00803     virtual const XMLCh*           getTextContent() const = 0;
00804 
00818     virtual void                   setTextContent(const XMLCh* textContent) = 0;
00819 
00837     virtual const XMLCh*           lookupNamespacePrefix(const XMLCh* namespaceURI,
00838                                                          bool useDefault) const = 0;
00839 
00851     virtual bool                   isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
00852 
00866     virtual const XMLCh*           lookupNamespaceURI(const XMLCh* prefix) const  = 0;
00867 
00884     virtual DOMNode*               getInterface(const XMLCh* feature) = 0;
00886 
00887     // -----------------------------------------------------------------------
00888     //  Non-standard Extension
00889     // -----------------------------------------------------------------------
00905     virtual void              release() = 0;
00907 #if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
00908     // -----------------------------------------------------------------------
00909     //  Non-standard Extension
00910     // -----------------------------------------------------------------------
00920     virtual void decRefCount() {}
00922 
00923     // -----------------------------------------------------------------------
00924     //  Non-standard Extension
00925     // -----------------------------------------------------------------------
00932     virtual void incRefCount() {}
00934 #endif
00935 };
00936 
00937 /***
00938  * Utilities macros for getting memory manager within DOM
00939 ***/
00940 #define GET_OWNER_DOCUMENT(ptr)      \
00941         ((DOMDocumentImpl*)(ptr->getOwnerDocument()))
00942 
00943 #define GET_DIRECT_MM(ptr)           \
00944         ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager        
00945 
00946 #define GET_INDIRECT_MM(ptr)                                                    \
00947         !ptr ? XMLPlatformUtils::fgMemoryManager :                              \
00948         GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
00949         XMLPlatformUtils::fgMemoryManager
00950 
00951 /***
00952  * For DOMNode and its derivatives
00953 ***/
00954 #define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
00955 
00956 XERCES_CPP_NAMESPACE_END
00957 
00958 #endif
00959 

Generated on Mon Feb 12 16:52:06 2007 for XQilla Simple API by  doxygen 1.4.6