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

Home

Readme
Download
Installation
Build

API Docs
Samples
Schema

FAQs
Programming
Migration

Releases
Bug-Reporting
Feedback

Y2K Compliance
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  

XMLEntityDecl.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  * 
00004  * Copyright (c) 1999-2000 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  * $Log: XMLEntityDecl.hpp,v $
00059  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
00060  * sane_include
00061  *
00062  * Revision 1.6  2000/02/24 20:00:23  abagchi
00063  * Swat for removing Log from API docs
00064  *
00065  * Revision 1.5  2000/02/16 23:03:48  roddey
00066  * More documentation updates
00067  *
00068  * Revision 1.4  2000/02/16 21:42:58  aruna1
00069  * API Doc++ summary changes in
00070  *
00071  * Revision 1.3  2000/02/15 01:21:30  roddey
00072  * Some initial documentation improvements. More to come...
00073  *
00074  * Revision 1.2  2000/02/06 07:47:48  rahulj
00075  * Year 2K copyright swat.
00076  *
00077  * Revision 1.1.1.1  1999/11/09 01:08:32  twl
00078  * Initial checkin
00079  *
00080  * Revision 1.2  1999/11/08 20:44:38  rahul
00081  * Swat for adding in Product name and CVS comment log variable.
00082  *
00083  */
00084 
00085 #if !defined(XMLENTITYDECL_HPP)
00086 #define XMLENTITYDECL_HPP
00087 
00088 #include <xercesc/util/XMLString.hpp>
00089 
00108 class  XMLEntityDecl
00109 {
00110 public:
00111     // -----------------------------------------------------------------------
00112     //  Constructors and Destructor
00113     // -----------------------------------------------------------------------
00114 
00117     
00121     XMLEntityDecl();
00122 
00127     XMLEntityDecl
00128     (
00129         const   XMLCh* const    entName
00130     );
00131     
00138     XMLEntityDecl
00139     (
00140         const   XMLCh* const    entName
00141         , const XMLCh* const    value
00142     );
00143 
00150     XMLEntityDecl
00151     (
00152         const   XMLCh* const    entName
00153         , const XMLCh           value
00154     );
00156 
00159 
00163     virtual ~XMLEntityDecl();
00164 
00166 
00167 
00168     // -----------------------------------------------------------------------
00169     //  Virtual entity decl interface
00170     // -----------------------------------------------------------------------
00171 
00174 
00182     virtual bool getDeclaredInIntSubset() const = 0;
00183 
00189     virtual bool getIsParameter() const = 0;
00190 
00196     virtual bool getIsSpecialChar() const = 0;
00197 
00199 
00200 
00201     // -----------------------------------------------------------------------
00202     //  Getter methods
00203     // -----------------------------------------------------------------------
00204 
00207 
00212     unsigned int getId() const;
00213 
00219     const XMLCh* getName() const;
00220 
00225     const XMLCh* getNotationName() const;
00226 
00231     const XMLCh* getPublicId() const;
00232 
00237     const XMLCh* getSystemId() const;
00238 
00244     const XMLCh* getValue() const;
00245 
00251     unsigned int getValueLen() const;
00252 
00257     bool isExternal() const;
00258 
00264     bool isUnparsed() const;
00265 
00267 
00268 
00269     // -----------------------------------------------------------------------
00270     //  Setter methods
00271     // -----------------------------------------------------------------------
00272 
00275 
00284     void setName
00285     (
00286         const   XMLCh* const    entName
00287     );
00288 
00295     void setNotationName(const XMLCh* const newName);
00296 
00303     void setPublicId(const XMLCh* const newId);
00304 
00314     void setSystemId(const XMLCh* const newId);
00315 
00323     void setValue(const XMLCh* const newValue);
00324 
00326 
00327     /* For internal use only */
00328     void setId(const unsigned int newId);
00329 
00330 
00331     // -----------------------------------------------------------------------
00332     //  Support named pool syntax
00333     // -----------------------------------------------------------------------
00334 
00337 
00344     const XMLCh* getKey() const;
00345 
00347 
00348 
00349 private :
00350     // -----------------------------------------------------------------------
00351     //  Unimplemented constructors and operators
00352     // -----------------------------------------------------------------------
00353     XMLEntityDecl(const XMLEntityDecl&);
00354     void operator=(XMLEntityDecl&);
00355 
00356 
00357     // -----------------------------------------------------------------------
00358     //  XMLEntityDecl: Private helper methods
00359     // -----------------------------------------------------------------------
00360     void cleanUp();
00361 
00362 
00363     // -----------------------------------------------------------------------
00364     //  Private data members
00365     //
00366     //  fId
00367     //      This is the unique id given to this entity decl.
00368     //
00369     //  fName
00370     //      The name of the enitity. Entity names are never namespace based.
00371     //
00372     //  fNotationName
00373     //      The optional notation of the entity. If there was none, then its
00374     //      empty.
00375     //
00376     //  fPublicId
00377     //      The public id of the entity, which can be empty.
00378     //
00379     //  fSystemId
00380     //      The system id of the entity.
00381     //
00382     //  fValue
00383     //  fValueLen
00384     //      The entity's value and length, which is only valid if its an
00385     //      internal style entity.
00386     // -----------------------------------------------------------------------
00387     unsigned int    fId;
00388     XMLCh*          fName;
00389     XMLCh*          fNotationName;
00390     XMLCh*          fPublicId;
00391     XMLCh*          fSystemId;
00392     XMLCh*          fValue;
00393     unsigned int    fValueLen;
00394 };
00395 
00396 
00397 // ---------------------------------------------------------------------------
00398 //  XMLEntityDecl: Getter methods
00399 // ---------------------------------------------------------------------------
00400 inline unsigned int XMLEntityDecl::getId() const
00401 {
00402     return fId;
00403 }
00404 
00405 inline const XMLCh* XMLEntityDecl::getName() const
00406 {
00407     return fName;
00408 }
00409 
00410 inline const XMLCh* XMLEntityDecl::getNotationName() const
00411 {
00412     return fNotationName;
00413 }
00414 
00415 inline const XMLCh* XMLEntityDecl::getPublicId() const
00416 {
00417     return fPublicId;
00418 }
00419 
00420 inline const XMLCh* XMLEntityDecl::getSystemId() const
00421 {
00422     return fSystemId;
00423 }
00424 
00425 inline const XMLCh* XMLEntityDecl::getValue() const
00426 {
00427     return fValue;
00428 }
00429 
00430 inline unsigned int XMLEntityDecl::getValueLen() const
00431 {
00432     return fValueLen;
00433 }
00434 
00435 inline bool XMLEntityDecl::isExternal() const
00436 {
00437     // If it has a system or public id, its external
00438     return ((fPublicId != 0) || (fSystemId != 0));
00439 }
00440 
00441 inline bool XMLEntityDecl::isUnparsed() const
00442 {
00443     // If it has a notation, its unparsed
00444     return (fNotationName != 0);
00445 }
00446 
00447 
00448 // ---------------------------------------------------------------------------
00449 //  XMLEntityDecl: Setter methods
00450 // ---------------------------------------------------------------------------
00451 inline void XMLEntityDecl::setId(const unsigned int newId)
00452 {
00453     fId = newId;
00454 }
00455 
00456 inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
00457 {
00458     delete [] fNotationName;
00459     fNotationName = XMLString::replicate(newName);
00460 }
00461 
00462 inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
00463 {
00464     delete [] fPublicId;
00465     fPublicId = XMLString::replicate(newId);
00466 }
00467 
00468 inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
00469 {
00470     delete [] fSystemId;
00471     fSystemId = XMLString::replicate(newId);
00472 }
00473 
00474 inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
00475 {
00476     delete [] fValue;
00477     fValue = XMLString::replicate(newValue);
00478     fValueLen = XMLString::stringLen(newValue);
00479 }
00480 
00481 
00482 // ---------------------------------------------------------------------------
00483 //  XMLEntityDecl: Support named pool syntax
00484 // ---------------------------------------------------------------------------
00485 inline const XMLCh* XMLEntityDecl::getKey() const
00486 {
00487     return fName;
00488 }
00489 
00490 #endif


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