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.11 2002/08/22 15:04:57 tng Exp $
00062  */
00063 
00064 #include <xercesc/util/XercesDefs.hpp>
00065 
00066 
00067 class DOMDocument;
00068 class DOMNamedNodeMap;
00069 class DOMNodeList;
00070 class DOMUserDataHandler;
00071 
00183 class   DOMNode {
00184 protected:
00185     // -----------------------------------------------------------------------
00186     //  Hidden constructors
00187     // -----------------------------------------------------------------------
00190     DOMNode() {};
00191     DOMNode(const DOMNode &) {};
00192     DOMNode & operator = (const DOMNode &) {return *this;};
00194 
00195 public:
00196     // -----------------------------------------------------------------------
00197     //  All constructors are hidden, just the destructor is available
00198     // -----------------------------------------------------------------------
00201 
00205     virtual ~DOMNode() {};
00207 
00208     // -----------------------------------------------------------------------
00209     //  Class Types
00210     // -----------------------------------------------------------------------
00213 
00218     enum NodeType {
00219         ELEMENT_NODE                = 1,
00220         ATTRIBUTE_NODE              = 2,
00221         TEXT_NODE                   = 3,
00222         CDATA_SECTION_NODE          = 4,
00223         ENTITY_REFERENCE_NODE       = 5,
00224         ENTITY_NODE                 = 6,
00225         PROCESSING_INSTRUCTION_NODE = 7,
00226         COMMENT_NODE                = 8,
00227         DOCUMENT_NODE               = 9,
00228         DOCUMENT_TYPE_NODE          = 10,
00229         DOCUMENT_FRAGMENT_NODE      = 11,
00230         NOTATION_NODE               = 12
00231     };
00232 
00259     enum DOMTreePosition {
00260         TREE_POSITION_PRECEDING   = 0x01,
00261         TREE_POSITION_FOLLOWING   = 0x02,
00262         TREE_POSITION_ANCESTOR    = 0x04,
00263         TREE_POSITION_DESCENDANT  = 0x08,
00264         TREE_POSITION_EQUIVALENT  = 0x10,
00265         TREE_POSITION_SAME_NODE   = 0x20,
00266         TREE_POSITION_DISCONNECTED = 0x00
00267     };
00269 
00270     // -----------------------------------------------------------------------
00271     //  Virtual DOMNode interface
00272     // -----------------------------------------------------------------------
00275     // -----------------------------------------------------------------------
00276     //  Getter methods
00277     // -----------------------------------------------------------------------
00282     virtual const XMLCh *   getNodeName() const = 0;
00283 
00291     virtual const XMLCh *       getNodeValue() const = 0;
00292 
00297     virtual short           getNodeType() const = 0;
00298 
00309     virtual DOMNode        *getParentNode() const = 0;
00310 
00325     virtual DOMNodeList    *getChildNodes() const = 0;
00332     virtual DOMNode        *getFirstChild() const = 0;
00333 
00340     virtual DOMNode        *getLastChild() const = 0;
00341 
00348     virtual DOMNode        *getPreviousSibling() const = 0;
00349 
00356     virtual DOMNode        *getNextSibling() const = 0;
00357 
00363     virtual DOMNamedNodeMap  *getAttributes() const = 0;
00364 
00376     virtual DOMDocument      *getOwnerDocument() const = 0;
00377 
00378     // -----------------------------------------------------------------------
00379     //  Node methods
00380     // -----------------------------------------------------------------------
00400     virtual DOMNode        * cloneNode(bool deep) const = 0;
00401 
00429     virtual DOMNode       *insertBefore(DOMNode *newChild,
00430                                           DOMNode *refChild) = 0;
00431 
00432 
00456     virtual DOMNode  *replaceChild(DOMNode *newChild,
00457                                      DOMNode *oldChild) = 0;
00470     virtual DOMNode        *removeChild(DOMNode *oldChild) = 0;
00471 
00492     virtual DOMNode        *appendChild(DOMNode *newChild) = 0;
00493 
00494     // -----------------------------------------------------------------------
00495     //  Query methods
00496     // -----------------------------------------------------------------------
00505     virtual bool             hasChildNodes() const = 0;
00506 
00507     // -----------------------------------------------------------------------
00508     //  Setter methods
00509     // -----------------------------------------------------------------------
00524     virtual void              setNodeValue(const XMLCh  *nodeValue) = 0;
00526 
00529 
00549     virtual void              normalize() = 0;
00550 
00566     virtual bool              isSupported(const XMLCh *feature,
00567                                            const XMLCh *version) const = 0;
00568 
00584     virtual const XMLCh *         getNamespaceURI() const = 0;
00585 
00592     virtual const XMLCh *          getPrefix() const = 0;
00593 
00603     virtual const XMLCh *          getLocalName() const = 0;
00604 
00638     virtual void              setPrefix(const XMLCh * prefix) = 0;
00639 
00646     virtual bool              hasAttributes() const = 0;
00648 
00651 
00668     virtual bool              isSameNode(const DOMNode* other) = 0;
00669 
00712     virtual bool              isEqualNode(const DOMNode* arg) = 0;
00713 
00714 
00742     virtual void*             setUserData(const XMLCh* key,
00743                                           void* data,
00744                                           DOMUserDataHandler* handler) = 0;
00745 
00759     virtual void*             getUserData(const XMLCh* key) const = 0;
00760 
00761 
00780     virtual const XMLCh*           getBaseURI() const = 0;
00781 
00794     virtual short                  compareTreePosition(DOMNode* other) = 0;
00795 
00844     virtual const XMLCh*           getTextContent() const = 0;
00845 
00894     virtual void                   setTextContent(const XMLCh* textContent) = 0;
00895 
00913     virtual const XMLCh*           lookupNamespacePrefix(const XMLCh* namespaceURI,
00914                                                          bool useDefault) const = 0;
00915 
00927     virtual bool                   isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
00928 
00942     virtual const XMLCh*           lookupNamespaceURI(const XMLCh* prefix) const  = 0;
00943 
00960     virtual DOMNode*               getInterface(const XMLCh* feature) = 0;
00962 
00963     // -----------------------------------------------------------------------
00964     //  Non-standard Extension
00965     // -----------------------------------------------------------------------
00968 
00981     virtual void              release() = 0;
00983 };
00984 
00985 
00986 #endif
00987 


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