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.3  2002/11/04 15:00:21  tng
00060  * C++ Namespace Support.
00061  *
00062  * Revision 1.2  2002/08/22 19:27:41  tng
00063  * [Bug 11448] DomCount has problems with XHTML1.1 DTD.
00064  *
00065  * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
00066  * sane_include
00067  *
00068  * Revision 1.6  2000/02/24 20:00:23  abagchi
00069  * Swat for removing Log from API docs
00070  *
00071  * Revision 1.5  2000/02/16 23:03:48  roddey
00072  * More documentation updates
00073  *
00074  * Revision 1.4  2000/02/16 21:42:58  aruna1
00075  * API Doc++ summary changes in
00076  *
00077  * Revision 1.3  2000/02/15 01:21:30  roddey
00078  * Some initial documentation improvements. More to come...
00079  *
00080  * Revision 1.2  2000/02/06 07:47:48  rahulj
00081  * Year 2K copyright swat.
00082  *
00083  * Revision 1.1.1.1  1999/11/09 01:08:32  twl
00084  * Initial checkin
00085  *
00086  * Revision 1.2  1999/11/08 20:44:38  rahul
00087  * Swat for adding in Product name and CVS comment log variable.
00088  *
00089  */
00090 
00091 #if !defined(XMLENTITYDECL_HPP)
00092 #define XMLENTITYDECL_HPP
00093 
00094 #include <xercesc/util/XMLString.hpp>
00095 
00096 XERCES_CPP_NAMESPACE_BEGIN
00097 
00116 class  XMLEntityDecl
00117 {
00118 public:
00119     // -----------------------------------------------------------------------
00120     //  Constructors and Destructor
00121     // -----------------------------------------------------------------------
00122 
00125 
00129     XMLEntityDecl();
00130 
00135     XMLEntityDecl
00136     (
00137         const   XMLCh* const    entName
00138     );
00139 
00146     XMLEntityDecl
00147     (
00148         const   XMLCh* const    entName
00149         , const XMLCh* const    value
00150     );
00151 
00158     XMLEntityDecl
00159     (
00160         const   XMLCh* const    entName
00161         , const XMLCh           value
00162     );
00164 
00167 
00171     virtual ~XMLEntityDecl();
00172 
00174 
00175 
00176     // -----------------------------------------------------------------------
00177     //  Virtual entity decl interface
00178     // -----------------------------------------------------------------------
00179 
00182 
00190     virtual bool getDeclaredInIntSubset() const = 0;
00191 
00197     virtual bool getIsParameter() const = 0;
00198 
00204     virtual bool getIsSpecialChar() const = 0;
00205 
00207 
00208 
00209     // -----------------------------------------------------------------------
00210     //  Getter methods
00211     // -----------------------------------------------------------------------
00212 
00215 
00220     unsigned int getId() const;
00221 
00227     const XMLCh* getName() const;
00228 
00233     const XMLCh* getNotationName() const;
00234 
00239     const XMLCh* getPublicId() const;
00240 
00245     const XMLCh* getSystemId() const;
00246 
00250     const XMLCh* getBaseURI() const;
00251 
00257     const XMLCh* getValue() const;
00258 
00264     unsigned int getValueLen() const;
00265 
00270     bool isExternal() const;
00271 
00277     bool isUnparsed() const;
00278 
00280 
00281 
00282     // -----------------------------------------------------------------------
00283     //  Setter methods
00284     // -----------------------------------------------------------------------
00285 
00288 
00297     void setName
00298     (
00299         const   XMLCh* const    entName
00300     );
00301 
00308     void setNotationName(const XMLCh* const newName);
00309 
00316     void setPublicId(const XMLCh* const newId);
00317 
00327     void setSystemId(const XMLCh* const newId);
00328 
00335     void setBaseURI(const XMLCh* const newId);
00336 
00344     void setValue(const XMLCh* const newValue);
00345 
00347 
00348     /* For internal use only */
00349     void setId(const unsigned int newId);
00350 
00351 
00352     // -----------------------------------------------------------------------
00353     //  Support named pool syntax
00354     // -----------------------------------------------------------------------
00355 
00358 
00365     const XMLCh* getKey() const;
00366 
00368 
00369 
00370 private :
00371     // -----------------------------------------------------------------------
00372     //  Unimplemented constructors and operators
00373     // -----------------------------------------------------------------------
00374     XMLEntityDecl(const XMLEntityDecl&);
00375     void operator=(XMLEntityDecl&);
00376 
00377 
00378     // -----------------------------------------------------------------------
00379     //  XMLEntityDecl: Private helper methods
00380     // -----------------------------------------------------------------------
00381     void cleanUp();
00382 
00383 
00384     // -----------------------------------------------------------------------
00385     //  Private data members
00386     //
00387     //  fId
00388     //      This is the unique id given to this entity decl.
00389     //
00390     //  fName
00391     //      The name of the enitity. Entity names are never namespace based.
00392     //
00393     //  fNotationName
00394     //      The optional notation of the entity. If there was none, then its
00395     //      empty.
00396     //
00397     //  fPublicId
00398     //      The public id of the entity, which can be empty.
00399     //
00400     //  fSystemId
00401     //      The system id of the entity.
00402     //
00403     //  fValue
00404     //  fValueLen
00405     //      The entity's value and length, which is only valid if its an
00406     //      internal style entity.
00407     //
00408     //  fBaseURI
00409     //      The base URI of the entity.   According to XML InfoSet, such value
00410     //      is the URI where it is declared (NOT referenced).
00411     // -----------------------------------------------------------------------
00412     unsigned int    fId;
00413     XMLCh*          fName;
00414     XMLCh*          fNotationName;
00415     XMLCh*          fPublicId;
00416     XMLCh*          fSystemId;
00417     XMLCh*          fValue;
00418     unsigned int    fValueLen;
00419     XMLCh*          fBaseURI;
00420 };
00421 
00422 
00423 // ---------------------------------------------------------------------------
00424 //  XMLEntityDecl: Getter methods
00425 // ---------------------------------------------------------------------------
00426 inline unsigned int XMLEntityDecl::getId() const
00427 {
00428     return fId;
00429 }
00430 
00431 inline const XMLCh* XMLEntityDecl::getName() const
00432 {
00433     return fName;
00434 }
00435 
00436 inline const XMLCh* XMLEntityDecl::getNotationName() const
00437 {
00438     return fNotationName;
00439 }
00440 
00441 inline const XMLCh* XMLEntityDecl::getPublicId() const
00442 {
00443     return fPublicId;
00444 }
00445 
00446 inline const XMLCh* XMLEntityDecl::getSystemId() const
00447 {
00448     return fSystemId;
00449 }
00450 
00451 inline const XMLCh* XMLEntityDecl::getBaseURI() const
00452 {
00453     return fBaseURI;
00454 }
00455 
00456 inline const XMLCh* XMLEntityDecl::getValue() const
00457 {
00458     return fValue;
00459 }
00460 
00461 inline unsigned int XMLEntityDecl::getValueLen() const
00462 {
00463     return fValueLen;
00464 }
00465 
00466 inline bool XMLEntityDecl::isExternal() const
00467 {
00468     // If it has a system or public id, its external
00469     return ((fPublicId != 0) || (fSystemId != 0));
00470 }
00471 
00472 inline bool XMLEntityDecl::isUnparsed() const
00473 {
00474     // If it has a notation, its unparsed
00475     return (fNotationName != 0);
00476 }
00477 
00478 
00479 // ---------------------------------------------------------------------------
00480 //  XMLEntityDecl: Setter methods
00481 // ---------------------------------------------------------------------------
00482 inline void XMLEntityDecl::setId(const unsigned int newId)
00483 {
00484     fId = newId;
00485 }
00486 
00487 inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
00488 {
00489     delete [] fNotationName;
00490     fNotationName = XMLString::replicate(newName);
00491 }
00492 
00493 inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
00494 {
00495     delete [] fPublicId;
00496     fPublicId = XMLString::replicate(newId);
00497 }
00498 
00499 inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
00500 {
00501     delete [] fSystemId;
00502     fSystemId = XMLString::replicate(newId);
00503 }
00504 
00505 inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId)
00506 {
00507     delete [] fBaseURI;
00508     fBaseURI = XMLString::replicate(newId);
00509 }
00510 
00511 inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
00512 {
00513     delete [] fValue;
00514     fValue = XMLString::replicate(newValue);
00515     fValueLen = XMLString::stringLen(newValue);
00516 }
00517 
00518 
00519 // ---------------------------------------------------------------------------
00520 //  XMLEntityDecl: Support named pool syntax
00521 // ---------------------------------------------------------------------------
00522 inline const XMLCh* XMLEntityDecl::getKey() const
00523 {
00524     return fName;
00525 }
00526 
00527 XERCES_CPP_NAMESPACE_END
00528 
00529 #endif


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