www.alphaworks.ibm.comwww.ibm.com/developerwww.ibm.com

Home

Readme
Download

Build







Migration

Releases

Feedback

Y2K Compliance


CVS Repository
Mail Archive

API Docs for SAX and DOM
 

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

DOM_Node.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
00005  * reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * 3. The end-user documentation included with the redistribution,
00020  *    if any, must include the following acknowledgment:
00021  *       "This product includes software developed by the
00022  *        Apache Software Foundation (http://www.apache.org/)."
00023  *    Alternately, this acknowledgment may appear in the software itself,
00024  *    if and wherever such third-party acknowledgments normally appear.
00025  *
00026  * 4. The names "Xerces" and "Apache Software Foundation" must
00027  *    not be used to endorse or promote products derived from this
00028  *    software without prior written permission. For written
00029  *    permission, please contact apache\@apache.org.
00030  *
00031  * 5. Products derived from this software may not be called "Apache",
00032  *    nor may "Apache" appear in their name, without prior written
00033  *    permission of the Apache Software Foundation.
00034  *
00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  * ====================================================================
00048  *
00049  * This software consists of voluntary contributions made by many
00050  * individuals on behalf of the Apache Software Foundation, and was
00051  * originally based on software copyright (c) 1999, International
00052  * Business Machines, Inc., http://www.ibm.com .  For more information
00053  * on the Apache Software Foundation, please see
00054  * <http://www.apache.org/>.
00055  */
00056 
00057 /*
00058  * $Id: DOM_Node.hpp,v 1.13 2001/05/11 13:25:20 tng Exp $
00059  */
00060 
00061 #ifndef DOM_Node_HEADER_GUARD_
00062 #define DOM_Node_HEADER_GUARD_
00063 
00064 #include <util/XercesDefs.hpp>
00065 #include <dom/DOMString.hpp>
00066 
00067 class DOM_NodeList;
00068 class DOM_NamedNodeMap;
00069 class DOM_Document;
00070 class NodeImpl;
00071 
00072 class DOM_NullPtr;  // A dummy class, with no implementation, that is
00073                     //  used as in overloaded functions as a way to
00074                     //  pass 0 or null.
00075 
00095 class   DOM_Node {
00096 
00097     public:
00100 
00108     DOM_Node();
00109 
00115     DOM_Node(const DOM_Node &other);
00116 
00122     DOM_Node & operator = (const DOM_Node &other);
00123 
00137     DOM_Node & operator = (const DOM_NullPtr *val);
00138 
00140 
00142 
00147     ~DOM_Node();
00148 
00150 
00152 
00163     bool operator == (const DOM_Node & other)const;
00164 
00170     bool operator == (const DOM_NullPtr *other) const;
00171 
00176     bool operator != (const DOM_Node & other) const;
00177 
00183    bool operator != (const DOM_NullPtr * other) const;
00184 
00185 
00186     enum NodeType {
00187         ELEMENT_NODE                = 1,
00188         ATTRIBUTE_NODE              = 2,
00189         TEXT_NODE                   = 3,
00190         CDATA_SECTION_NODE          = 4,
00191         ENTITY_REFERENCE_NODE       = 5,
00192         ENTITY_NODE                 = 6,
00193         PROCESSING_INSTRUCTION_NODE = 7,
00194         COMMENT_NODE                = 8,
00195         DOCUMENT_NODE               = 9,
00196         DOCUMENT_TYPE_NODE          = 10,
00197         DOCUMENT_FRAGMENT_NODE      = 11,
00198         NOTATION_NODE               = 12,
00199         XML_DECL_NODE               = 13
00200     };
00201 
00203 
00205 
00209     DOMString       getNodeName() const;
00210 
00221     DOMString       getNodeValue() const;
00222 
00226     short           getNodeType() const;
00227 
00237     DOM_Node        getParentNode() const;
00238 
00252     DOM_NodeList    getChildNodes() const;
00258     DOM_Node        getFirstChild() const;
00259 
00265     DOM_Node        getLastChild() const;
00266 
00272     DOM_Node        getPreviousSibling() const;
00273 
00279     DOM_Node        getNextSibling() const;
00280 
00285     DOM_NamedNodeMap  getAttributes() const;
00286 
00299     DOM_Document      getOwnerDocument() const;
00300 
00309     void              *getUserData() const;
00310 
00312 
00314 
00333     DOM_Node         cloneNode(bool deep) const;
00334 
00336 
00338 
00365     DOM_Node               insertBefore(const DOM_Node &newChild,
00366                                         const DOM_Node &refChild);
00367 
00368 
00391     DOM_Node       replaceChild(const DOM_Node &newChild,
00392                                 const DOM_Node &oldChild);
00404     DOM_Node        removeChild(const DOM_Node &oldChild);
00405 
00425     DOM_Node        appendChild(const DOM_Node &newChild);
00426 
00428 
00430 
00438     bool             hasChildNodes() const;
00439 
00440 
00453     bool                    isNull() const;
00454 
00456 
00458 
00459 
00473     void              setNodeValue(const DOMString &nodeValue);
00474 
00492     void              setUserData(void *p);
00493 
00495 
00497 
00519     void              normalize();
00520 
00537     bool              supports(const DOMString &feature,
00538                            const DOMString &version) const;
00539 
00556     DOMString         getNamespaceURI() const;
00557 
00565     DOMString         getPrefix() const;
00566 
00577     DOMString         getLocalName() const;
00578 
00612     void              setPrefix(const DOMString &prefix);
00613 
00615 
00616 protected:
00617     NodeImpl   *fImpl;
00618 
00619     DOM_Node(NodeImpl *);
00620 
00621     friend class DOM_Document;
00622     friend class DocumentImpl;
00623     friend class TreeWalkerImpl;
00624     friend class NodeIteratorImpl;
00625     friend class DOM_NamedNodeMap;
00626     friend class DOM_NodeList;
00627     friend class DOMParser;
00628     friend class DOM_Entity;
00629     friend class RangeImpl;
00630     friend class CharacterDataImpl;
00631     friend class XUtil;
00632 
00633 };
00634 
00635 
00636 #endif
00637 


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