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  

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.2  2002/08/22 19:27:41  tng
00060  * [Bug 11448] DomCount has problems with XHTML1.1 DTD.
00061  *
00062  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
00063  * sane_include
00064  *
00065  * Revision 1.6  2000/02/24 20:00:23  abagchi
00066  * Swat for removing Log from API docs
00067  *
00068  * Revision 1.5  2000/02/16 23:03:48  roddey
00069  * More documentation updates
00070  *
00071  * Revision 1.4  2000/02/16 21:42:58  aruna1
00072  * API Doc++ summary changes in
00073  *
00074  * Revision 1.3  2000/02/15 01:21:30  roddey
00075  * Some initial documentation improvements. More to come...
00076  *
00077  * Revision 1.2  2000/02/06 07:47:48  rahulj
00078  * Year 2K copyright swat.
00079  *
00080  * Revision 1.1.1.1  1999/11/09 01:08:32  twl
00081  * Initial checkin
00082  *
00083  * Revision 1.2  1999/11/08 20:44:38  rahul
00084  * Swat for adding in Product name and CVS comment log variable.
00085  *
00086  */
00087 
00088 #if !defined(XMLENTITYDECL_HPP)
00089 #define XMLENTITYDECL_HPP
00090 
00091 #include <xercesc/util/XMLString.hpp>
00092 
00111 class  XMLEntityDecl
00112 {
00113 public:
00114     // -----------------------------------------------------------------------
00115     //  Constructors and Destructor
00116     // -----------------------------------------------------------------------
00117 
00120 
00124     XMLEntityDecl();
00125 
00130     XMLEntityDecl
00131     (
00132         const   XMLCh* const    entName
00133     );
00134 
00141     XMLEntityDecl
00142     (
00143         const   XMLCh* const    entName
00144         , const XMLCh* const    value
00145     );
00146 
00153     XMLEntityDecl
00154     (
00155         const   XMLCh* const    entName
00156         , const XMLCh           value
00157     );
00159 
00162 
00166     virtual ~XMLEntityDecl();
00167 
00169 
00170 
00171     // -----------------------------------------------------------------------
00172     //  Virtual entity decl interface
00173     // -----------------------------------------------------------------------
00174 
00177 
00185     virtual bool getDeclaredInIntSubset() const = 0;
00186 
00192     virtual bool getIsParameter() const = 0;
00193 
00199     virtual bool getIsSpecialChar() const = 0;
00200 
00202 
00203 
00204     // -----------------------------------------------------------------------
00205     //  Getter methods
00206     // -----------------------------------------------------------------------
00207 
00210 
00215     unsigned int getId() const;
00216 
00222     const XMLCh* getName() const;
00223 
00228     const XMLCh* getNotationName() const;
00229 
00234     const XMLCh* getPublicId() const;
00235 
00240     const XMLCh* getSystemId() const;
00241 
00245     const XMLCh* getBaseURI() const;
00246 
00252     const XMLCh* getValue() const;
00253 
00259     unsigned int getValueLen() const;
00260 
00265     bool isExternal() const;
00266 
00272     bool isUnparsed() const;
00273 
00275 
00276 
00277     // -----------------------------------------------------------------------
00278     //  Setter methods
00279     // -----------------------------------------------------------------------
00280 
00283 
00292     void setName
00293     (
00294         const   XMLCh* const    entName
00295     );
00296 
00303     void setNotationName(const XMLCh* const newName);
00304 
00311     void setPublicId(const XMLCh* const newId);
00312 
00322     void setSystemId(const XMLCh* const newId);
00323 
00330     void setBaseURI(const XMLCh* const newId);
00331 
00339     void setValue(const XMLCh* const newValue);
00340 
00342 
00343     /* For internal use only */
00344     void setId(const unsigned int newId);
00345 
00346 
00347     // -----------------------------------------------------------------------
00348     //  Support named pool syntax
00349     // -----------------------------------------------------------------------
00350 
00353 
00360     const XMLCh* getKey() const;
00361 
00363 
00364 
00365 private :
00366     // -----------------------------------------------------------------------
00367     //  Unimplemented constructors and operators
00368     // -----------------------------------------------------------------------
00369     XMLEntityDecl(const XMLEntityDecl&);
00370     void operator=(XMLEntityDecl&);
00371 
00372 
00373     // -----------------------------------------------------------------------
00374     //  XMLEntityDecl: Private helper methods
00375     // -----------------------------------------------------------------------
00376     void cleanUp();
00377 
00378 
00379     // -----------------------------------------------------------------------
00380     //  Private data members
00381     //
00382     //  fId
00383     //      This is the unique id given to this entity decl.
00384     //
00385     //  fName
00386     //      The name of the enitity. Entity names are never namespace based.
00387     //
00388     //  fNotationName
00389     //      The optional notation of the entity. If there was none, then its
00390     //      empty.
00391     //
00392     //  fPublicId
00393     //      The public id of the entity, which can be empty.
00394     //
00395     //  fSystemId
00396     //      The system id of the entity.
00397     //
00398     //  fValue
00399     //  fValueLen
00400     //      The entity's value and length, which is only valid if its an
00401     //      internal style entity.
00402     //
00403     //  fBaseURI
00404     //      The base URI of the entity.   According to XML InfoSet, such value
00405     //      is the URI where it is declared (NOT referenced).
00406     // -----------------------------------------------------------------------
00407     unsigned int    fId;
00408     XMLCh*          fName;
00409     XMLCh*          fNotationName;
00410     XMLCh*          fPublicId;
00411     XMLCh*          fSystemId;
00412     XMLCh*          fValue;
00413     unsigned int    fValueLen;
00414     XMLCh*          fBaseURI;
00415 };
00416 
00417 
00418 // ---------------------------------------------------------------------------
00419 //  XMLEntityDecl: Getter methods
00420 // ---------------------------------------------------------------------------
00421 inline unsigned int XMLEntityDecl::getId() const
00422 {
00423     return fId;
00424 }
00425 
00426 inline const XMLCh* XMLEntityDecl::getName() const
00427 {
00428     return fName;
00429 }
00430 
00431 inline const XMLCh* XMLEntityDecl::getNotationName() const
00432 {
00433     return fNotationName;
00434 }
00435 
00436 inline const XMLCh* XMLEntityDecl::getPublicId() const
00437 {
00438     return fPublicId;
00439 }
00440 
00441 inline const XMLCh* XMLEntityDecl::getSystemId() const
00442 {
00443     return fSystemId;
00444 }
00445 
00446 inline const XMLCh* XMLEntityDecl::getBaseURI() const
00447 {
00448     return fBaseURI;
00449 }
00450 
00451 inline const XMLCh* XMLEntityDecl::getValue() const
00452 {
00453     return fValue;
00454 }
00455 
00456 inline unsigned int XMLEntityDecl::getValueLen() const
00457 {
00458     return fValueLen;
00459 }
00460 
00461 inline bool XMLEntityDecl::isExternal() const
00462 {
00463     // If it has a system or public id, its external
00464     return ((fPublicId != 0) || (fSystemId != 0));
00465 }
00466 
00467 inline bool XMLEntityDecl::isUnparsed() const
00468 {
00469     // If it has a notation, its unparsed
00470     return (fNotationName != 0);
00471 }
00472 
00473 
00474 // ---------------------------------------------------------------------------
00475 //  XMLEntityDecl: Setter methods
00476 // ---------------------------------------------------------------------------
00477 inline void XMLEntityDecl::setId(const unsigned int newId)
00478 {
00479     fId = newId;
00480 }
00481 
00482 inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
00483 {
00484     delete [] fNotationName;
00485     fNotationName = XMLString::replicate(newName);
00486 }
00487 
00488 inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
00489 {
00490     delete [] fPublicId;
00491     fPublicId = XMLString::replicate(newId);
00492 }
00493 
00494 inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
00495 {
00496     delete [] fSystemId;
00497     fSystemId = XMLString::replicate(newId);
00498 }
00499 
00500 inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId)
00501 {
00502     delete [] fBaseURI;
00503     fBaseURI = XMLString::replicate(newId);
00504 }
00505 
00506 inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
00507 {
00508     delete [] fValue;
00509     fValue = XMLString::replicate(newValue);
00510     fValueLen = XMLString::stringLen(newValue);
00511 }
00512 
00513 
00514 // ---------------------------------------------------------------------------
00515 //  XMLEntityDecl: Support named pool syntax
00516 // ---------------------------------------------------------------------------
00517 inline const XMLCh* XMLEntityDecl::getKey() const
00518 {
00519     return fName;
00520 }
00521 
00522 #endif


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