DOMNode.hpp Source File

| API Docs for SAX and DOM |

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# DOMNode.hpp

Go to the documentation of this file.

    00001 #ifndef DOMNode_HEADER_GUARD_
    00002 #define DOMNode_HEADER_GUARD_
    00003
    00004 /*
    00005  * The Apache Software License, Version 1.1
    00006  *
    00007  * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    00008  * reserved.
    00009  *
    00010  * Redistribution and use in source and binary forms, with or without
    00011  * modification, are permitted provided that the following conditions
    00012  * are met:
    00013  *
    00014  * 1. Redistributions of source code must retain the above copyright
    00015  *    notice, this list of conditions and the following disclaimer.
    00016  *
    00017  * 2. Redistributions in binary form must reproduce the above copyright
    00018  *    notice, this list of conditions and the following disclaimer in
    00019  *    the documentation and/or other materials provided with the
    00020  *    distribution.
    00021  *
    00022  * 3. The end-user documentation included with the redistribution,
    00023  *    if any, must include the following acknowledgment:
    00024  *       "This product includes software developed by the
    00025  *        Apache Software Foundation (http://www.apache.org/)."
    00026  *    Alternately, this acknowledgment may appear in the software itself,
    00027  *    if and wherever such third-party acknowledgments normally appear.
    00028  *
    00029  * 4. The names "Xerces" and "Apache Software Foundation" must
    00030  *    not be used to endorse or promote products derived from this
    00031  *    software without prior written permission. For written
    00032  *    permission, please contact apache\@apache.org.
    00033  *
    00034  * 5. Products derived from this software may not be called "Apache",
    00035  *    nor may "Apache" appear in their name, without prior written
    00036  *    permission of the Apache Software Foundation.
    00037  *
    00038  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    00039  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    00040  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    00041  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    00042  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00043  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    00044  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    00045  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00046  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    00047  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    00048  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00049  * SUCH DAMAGE.
    00050  * ====================================================================
    00051  *
    00052  * This software consists of voluntary contributions made by many
    00053  * individuals on behalf of the Apache Software Foundation, and was
    00054  * originally based on software copyright (c) 2001, International
    00055  * Business Machines, Inc., http://www.ibm.com .  For more information
    00056  * on the Apache Software Foundation, please see
    00057  * <http://www.apache.org/>.
    00058  */
    00059
    00060 /*
    00061  * $Id: DOMNode.hpp,v 1.15 2003/05/05 21:21:15 neilg Exp $
    00062  */
    00063
    00064 #include <xercesc/util/XercesDefs.hpp>
    00065
    00066 XERCES_CPP_NAMESPACE_BEGIN
    00067
    00068
    00069 class DOMDocument;
    00070 class DOMNamedNodeMap;
    00071 class DOMNodeList;
    00072 class DOMUserDataHandler;
    00073
    00185 class   DOMNode {
    00186 protected:
    00187     // -----------------------------------------------------------------------
    00188     //  Hidden constructors
    00189     // -----------------------------------------------------------------------
    00192     DOMNode() {};
    00194
    00195 private:
    00196     // -----------------------------------------------------------------------
    00197     // Unimplemented constructors and operators
    00198     // -----------------------------------------------------------------------
    00201     DOMNode(const DOMNode &);
    00202     DOMNode & operator = (const DOMNode &);
    00204
    00205 public:
    00206     // -----------------------------------------------------------------------
    00207     //  All constructors are hidden, just the destructor is available
    00208     // -----------------------------------------------------------------------
    00215     virtual ~DOMNode() {};
    00217
    00218     // -----------------------------------------------------------------------
    00219     //  Class Types
    00220     // -----------------------------------------------------------------------
    00228     enum NodeType {
    00229         ELEMENT_NODE                = 1,
    00230         ATTRIBUTE_NODE              = 2,
    00231         TEXT_NODE                   = 3,
    00232         CDATA_SECTION_NODE          = 4,
    00233         ENTITY_REFERENCE_NODE       = 5,
    00234         ENTITY_NODE                 = 6,
    00235         PROCESSING_INSTRUCTION_NODE = 7,
    00236         COMMENT_NODE                = 8,
    00237         DOCUMENT_NODE               = 9,
    00238         DOCUMENT_TYPE_NODE          = 10,
    00239         DOCUMENT_FRAGMENT_NODE      = 11,
    00240         NOTATION_NODE               = 12
    00241     };
    00242
    00269     enum DOMTreePosition {
    00270         TREE_POSITION_PRECEDING   = 0x01,
    00271         TREE_POSITION_FOLLOWING   = 0x02,
    00272         TREE_POSITION_ANCESTOR    = 0x04,
    00273         TREE_POSITION_DESCENDANT  = 0x08,
    00274         TREE_POSITION_EQUIVALENT  = 0x10,
    00275         TREE_POSITION_SAME_NODE   = 0x20,
    00276         TREE_POSITION_DISCONNECTED = 0x00
    00277     };
    00279
    00280     // -----------------------------------------------------------------------
    00281     //  Virtual DOMNode interface
    00282     // -----------------------------------------------------------------------
    00285     // -----------------------------------------------------------------------
    00286     //  Getter methods
    00287     // -----------------------------------------------------------------------
    00292     virtual const XMLCh *   getNodeName() const = 0;
    00293
    00301     virtual const XMLCh *       getNodeValue() const = 0;
    00302
    00307     virtual short           getNodeType() const = 0;
    00308
    00319     virtual DOMNode        *getParentNode() const = 0;
    00320
    00335     virtual DOMNodeList    *getChildNodes() const = 0;
    00342     virtual DOMNode        *getFirstChild() const = 0;
    00343
    00350     virtual DOMNode        *getLastChild() const = 0;
    00351
    00358     virtual DOMNode        *getPreviousSibling() const = 0;
    00359
    00366     virtual DOMNode        *getNextSibling() const = 0;
    00367
    00373     virtual DOMNamedNodeMap  *getAttributes() const = 0;
    00374
    00386     virtual DOMDocument      *getOwnerDocument() const = 0;
    00387
    00388     // -----------------------------------------------------------------------
    00389     //  Node methods
    00390     // -----------------------------------------------------------------------
    00410     virtual DOMNode        * cloneNode(bool deep) const = 0;
    00411
    00439     virtual DOMNode       *insertBefore(DOMNode *newChild,
    00440                                           DOMNode *refChild) = 0;
    00441
    00442
    00466     virtual DOMNode  *replaceChild(DOMNode *newChild,
    00467                                      DOMNode *oldChild) = 0;
    00480     virtual DOMNode        *removeChild(DOMNode *oldChild) = 0;
    00481
    00502     virtual DOMNode        *appendChild(DOMNode *newChild) = 0;
    00503
    00504     // -----------------------------------------------------------------------
    00505     //  Query methods
    00506     // -----------------------------------------------------------------------
    00515     virtual bool             hasChildNodes() const = 0;
    00516
    00517     // -----------------------------------------------------------------------
    00518     //  Setter methods
    00519     // -----------------------------------------------------------------------
    00534     virtual void              setNodeValue(const XMLCh  *nodeValue) = 0;
    00536
    00559     virtual void              normalize() = 0;
    00560
    00576     virtual bool              isSupported(const XMLCh *feature,
    00577                                            const XMLCh *version) const = 0;
    00578
    00594     virtual const XMLCh *         getNamespaceURI() const = 0;
    00595
    00602     virtual const XMLCh *          getPrefix() const = 0;
    00603
    00613     virtual const XMLCh *          getLocalName() const = 0;
    00614
    00648     virtual void              setPrefix(const XMLCh * prefix) = 0;
    00649
    00656     virtual bool              hasAttributes() const = 0;
    00658
    00678     virtual bool              isSameNode(const DOMNode* other) const = 0;
    00679
    00722     virtual bool              isEqualNode(const DOMNode* arg) const = 0;
    00723
    00724
    00752     virtual void*             setUserData(const XMLCh* key,
    00753                                           void* data,
    00754                                           DOMUserDataHandler* handler) = 0;
    00755
    00769     virtual void*             getUserData(const XMLCh* key) const = 0;
    00770
    00771
    00790     virtual const XMLCh*           getBaseURI() const = 0;
    00791
    00804     virtual short                  compareTreePosition(const DOMNode* other) const = 0;
    00805
    00854     virtual const XMLCh*           getTextContent() const = 0;
    00855
    00904     virtual void                   setTextContent(const XMLCh* textContent) = 0;
    00905
    00923     virtual const XMLCh*           lookupNamespacePrefix(const XMLCh* namespaceURI,
    00924                                                          bool useDefault) const = 0;
    00925
    00937     virtual bool                   isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
    00938
    00952     virtual const XMLCh*           lookupNamespaceURI(const XMLCh* prefix) const  = 0;
    00953
    00970     virtual DOMNode*               getInterface(const XMLCh* feature) = 0;
    00972
    00973     // -----------------------------------------------------------------------
    00974     //  Non-standard Extension
    00975     // -----------------------------------------------------------------------
    00991     virtual void              release() = 0;
    00993 #if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
    00994     // -----------------------------------------------------------------------
    00995     //  Non-standard Extension
    00996     // -----------------------------------------------------------------------
    01006     virtual void decRefCount() {}
    01008
    01009     // -----------------------------------------------------------------------
    01010     //  Non-standard Extension
    01011     // -----------------------------------------------------------------------
    01018     virtual void incRefCount() {}
    01020 #endif
    01021 };
    01022
    01023 XERCES_CPP_NAMESPACE_END
    01024
    01025 #endif
    01026

Copyright © 2000 The Apache Software Foundation. All Rights Reserved.