http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

CVS Repository
Mail Archive

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.13 2002/11/04 15:09:24 tng 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() {};
00193     DOMNode(const DOMNode &) {};
00194     DOMNode & operator = (const DOMNode &) {return *this;};
00196 
00197 public:
00198     // -----------------------------------------------------------------------
00199     //  All constructors are hidden, just the destructor is available
00200     // -----------------------------------------------------------------------
00207     virtual ~DOMNode() {};
00209 
00210     // -----------------------------------------------------------------------
00211     //  Class Types
00212     // -----------------------------------------------------------------------
00220     enum NodeType {
00221         ELEMENT_NODE                = 1,
00222         ATTRIBUTE_NODE              = 2,
00223         TEXT_NODE                   = 3,
00224         CDATA_SECTION_NODE          = 4,
00225         ENTITY_REFERENCE_NODE       = 5,
00226         ENTITY_NODE                 = 6,
00227         PROCESSING_INSTRUCTION_NODE = 7,
00228         COMMENT_NODE                = 8,
00229         DOCUMENT_NODE               = 9,
00230         DOCUMENT_TYPE_NODE          = 10,
00231         DOCUMENT_FRAGMENT_NODE      = 11,
00232         NOTATION_NODE               = 12
00233     };
00234 
00261     enum DOMTreePosition {
00262         TREE_POSITION_PRECEDING   = 0x01,
00263         TREE_POSITION_FOLLOWING   = 0x02,
00264         TREE_POSITION_ANCESTOR    = 0x04,
00265         TREE_POSITION_DESCENDANT  = 0x08,
00266         TREE_POSITION_EQUIVALENT  = 0x10,
00267         TREE_POSITION_SAME_NODE   = 0x20,
00268         TREE_POSITION_DISCONNECTED = 0x00
00269     };
00271 
00272     // -----------------------------------------------------------------------
00273     //  Virtual DOMNode interface
00274     // -----------------------------------------------------------------------
00277     // -----------------------------------------------------------------------
00278     //  Getter methods
00279     // -----------------------------------------------------------------------
00284     virtual const XMLCh *   getNodeName() const = 0;
00285 
00293     virtual const XMLCh *       getNodeValue() const = 0;
00294 
00299     virtual short           getNodeType() const = 0;
00300 
00311     virtual DOMNode        *getParentNode() const = 0;
00312 
00327     virtual DOMNodeList    *getChildNodes() const = 0;
00334     virtual DOMNode        *getFirstChild() const = 0;
00335 
00342     virtual DOMNode        *getLastChild() const = 0;
00343 
00350     virtual DOMNode        *getPreviousSibling() const = 0;
00351 
00358     virtual DOMNode        *getNextSibling() const = 0;
00359 
00365     virtual DOMNamedNodeMap  *getAttributes() const = 0;
00366 
00378     virtual DOMDocument      *getOwnerDocument() const = 0;
00379 
00380     // -----------------------------------------------------------------------
00381     //  Node methods
00382     // -----------------------------------------------------------------------
00402     virtual DOMNode        * cloneNode(bool deep) const = 0;
00403 
00431     virtual DOMNode       *insertBefore(DOMNode *newChild,
00432                                           DOMNode *refChild) = 0;
00433 
00434 
00458     virtual DOMNode  *replaceChild(DOMNode *newChild,
00459                                      DOMNode *oldChild) = 0;
00472     virtual DOMNode        *removeChild(DOMNode *oldChild) = 0;
00473 
00494     virtual DOMNode        *appendChild(DOMNode *newChild) = 0;
00495 
00496     // -----------------------------------------------------------------------
00497     //  Query methods
00498     // -----------------------------------------------------------------------
00507     virtual bool             hasChildNodes() const = 0;
00508 
00509     // -----------------------------------------------------------------------
00510     //  Setter methods
00511     // -----------------------------------------------------------------------
00526     virtual void              setNodeValue(const XMLCh  *nodeValue) = 0;
00528 
00551     virtual void              normalize() = 0;
00552 
00568     virtual bool              isSupported(const XMLCh *feature,
00569                                            const XMLCh *version) const = 0;
00570 
00586     virtual const XMLCh *         getNamespaceURI() const = 0;
00587 
00594     virtual const XMLCh *          getPrefix() const = 0;
00595 
00605     virtual const XMLCh *          getLocalName() const = 0;
00606 
00640     virtual void              setPrefix(const XMLCh * prefix) = 0;
00641 
00648     virtual bool              hasAttributes() const = 0;
00650 
00670     virtual bool              isSameNode(const DOMNode* other) const = 0;
00671 
00714     virtual bool              isEqualNode(const DOMNode* arg) const = 0;
00715 
00716 
00744     virtual void*             setUserData(const XMLCh* key,
00745                                           void* data,
00746                                           DOMUserDataHandler* handler) = 0;
00747 
00761     virtual void*             getUserData(const XMLCh* key) const = 0;
00762 
00763 
00782     virtual const XMLCh*           getBaseURI() const = 0;
00783 
00796     virtual short                  compareTreePosition(const DOMNode* other) const = 0;
00797 
00846     virtual const XMLCh*           getTextContent() const = 0;
00847 
00896     virtual void                   setTextContent(const XMLCh* textContent) = 0;
00897 
00915     virtual const XMLCh*           lookupNamespacePrefix(const XMLCh* namespaceURI,
00916                                                          bool useDefault) const = 0;
00917 
00929     virtual bool                   isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
00930 
00944     virtual const XMLCh*           lookupNamespaceURI(const XMLCh* prefix) const  = 0;
00945 
00962     virtual DOMNode*               getInterface(const XMLCh* feature) = 0;
00964 
00965     // -----------------------------------------------------------------------
00966     //  Non-standard Extension
00967     // -----------------------------------------------------------------------
00983     virtual void              release() = 0;
00985 };
00986 
00987 
00988 XERCES_CPP_NAMESPACE_END
00989 
00990 #endif
00991 


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