SAXParser.hpp Source File

| API Docs for SAX and DOM |

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

# SAXParser.hpp

Go to the documentation of this file.

    00001 /*
    00002  * The Apache Software License, Version 1.1
    00003  *
    00004  * Copyright (c) 1999-2003 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: SAXParser.hpp,v $
    00059  * Revision 1.23  2003/05/15 18:26:50  knoaman
    00060  * Partial implementation of the configurable memory manager.
    00061  *
    00062  * Revision 1.22  2003/04/17 21:58:50  neilg
    00063  * Adding a new property,
    00064  * http://apache.org/xml/properties/security-manager, with
    00065  * appropriate getSecurityManager/setSecurityManager methods on DOM
    00066  * and SAX parsers.  Also adding a new SecurityManager class.
    00067  *
    00068  * The purpose of these modifications is to permit applications a
    00069  * means to have the parser reject documents whose processing would
    00070  * otherwise consume large amounts of system resources.  Malicious
    00071  * use of such documents could be used to launch a denial-of-service
    00072  * attack against a system running the parser.  Initially, the
    00073  * SecurityManager only knows about attacks that can result from
    00074  * exponential entity expansion; this is the only known attack that
    00075  * involves processing a single XML document.  Other, simlar attacks
    00076  * can be launched if arbitrary schemas may be parsed; there already
    00077  * exist means (via use of the EntityResolver interface) by which
    00078  * applications can deny processing of untrusted schemas.  In future,
    00079  * the SecurityManager will be expanded to take these other exploits
    00080  * into account.
    00081  *
    00082  * Add support for the SecurityManager
    00083  *
    00084  * Revision 1.21  2003/03/07 18:09:17  tng
    00085  * Return a reference instead of void for operator=
    00086  *
    00087  * Revision 1.20  2003/02/04 19:27:43  knoaman
    00088  * Performance: use global buffer to eliminate repetitive memory creation/deletion.
    00089  *
    00090  * Revision 1.19  2003/01/09 19:07:08  tng
    00091  * [Bug 15802] Add "const" qualifier to getURIText.
    00092  *
    00093  * Revision 1.18  2003/01/03 20:09:36  tng
    00094  * New feature StandardUriConformant to force strict standard uri conformance.
    00095  *
    00096  * Revision 1.17  2002/12/30 20:15:51  knoaman
    00097  * Make calculate src offset option false by default.
    00098  *
    00099  * Revision 1.16  2002/12/23 15:23:18  knoaman
    00100  * Added a public api to various parsers to return the src offset within the input
    00101  * source.
    00102  *
    00103  * Revision 1.15  2002/12/04 01:57:09  knoaman
    00104  * Scanner re-organization.
    00105  *
    00106  * Revision 1.14  2002/11/04 14:57:03  tng
    00107  * C++ Namespace Support.
    00108  *
    00109  * Revision 1.13  2002/08/14 15:20:38  knoaman
    00110  * [Bug 3111] Problem with LexicalHandler::startDTD() and LexicalHandler::endDTD().
    00111  *
    00112  * Revision 1.12  2002/07/11 18:27:03  knoaman
    00113  * Grammar caching/preparsing - initial implementation.
    00114  *
    00115  * Revision 1.11  2002/06/27 18:48:04  tng
    00116  * API Documentation Update and move getScanner as protected
    00117  *
    00118  * Revision 1.10  2002/06/17 15:41:44  tng
    00119  * Update API Documentation
    00120  *
    00121  * Revision 1.9  2002/06/06 20:38:18  tng
    00122  * Document Fix: document that the returned object from resolveEntity is owned by the parser
    00123  *
    00124  * Revision 1.8  2002/05/31 15:13:53  tng
    00125  * Fix doxygen documentation.
    00126  *
    00127  * Revision 1.7  2002/05/30 16:39:06  knoaman
    00128  * DOM L3 LS.
    00129  *
    00130  * Revision 1.6  2002/05/30 16:20:09  tng
    00131  * Add feature to optionally ignore external DTD.
    00132  *
    00133  * Revision 1.5  2002/05/29 21:37:47  knoaman
    00134  * Add baseURI to resolveEntity to support DOMInputSource.
    00135  *
    00136  * Revision 1.4  2002/05/28 20:44:14  tng
    00137  * [Bug 9104] prefixes dissapearing when schema validation turned on.
    00138  *
    00139  * Revision 1.3  2002/05/27 18:39:21  tng
    00140  * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
    00141  *
    00142  * Revision 1.2  2002/02/20 18:17:01  tng
    00143  * [Bug 5977] Warnings on generating apiDocs.
    00144  *
    00145  * Revision 1.1.1.1  2002/02/01 22:22:07  peiyongz
    00146  * sane_include
    00147  *
    00148  * Revision 1.22  2001/12/05 22:09:02  tng
    00149  * Update documentation for setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation.
    00150  *
    00151  * Revision 1.21  2001/11/20 18:51:44  tng
    00152  * Schema: schemaLocation and noNamespaceSchemaLocation to be specified outside the instance document.  New methods setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation are added (for SAX2, two new properties are added).
    00153  *
    00154  * Revision 1.20  2001/08/01 19:11:02  tng
    00155  * Add full schema constraint checking flag to the samples and the parser.
    00156  *
    00157  * Revision 1.19  2001/07/27 20:24:21  tng
    00158  * put getScanner() back as they were there before, not to break existing apps.
    00159  *
    00160  * Revision 1.18  2001/07/16 12:52:09  tng
    00161  * APIDocs fix: default for schema processing in DOMParser, IDOMParser, and SAXParser should be false.
    00162  *
    00163  * Revision 1.17  2001/06/23 14:13:16  tng
    00164  * Remove getScanner from the Parser headers as this is not needed and Scanner is not internal class.
    00165  *
    00166  * Revision 1.16  2001/06/03 19:26:20  jberry
    00167  * Add support for querying error count following parse; enables simple parse without requiring error handler.
    00168  *
    00169  * Revision 1.15  2001/05/11 13:26:22  tng
    00170  * Copyright update.
    00171  *
    00172  * Revision 1.14  2001/05/03 19:09:25  knoaman
    00173  * Support Warning/Error/FatalError messaging.
    00174  * Validity constraints errors are treated as errors, with the ability by user to set
    00175  * validity constraints as fatal errors.
    00176  *
    00177  * Revision 1.13  2001/03/30 16:46:57  tng
    00178  * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
    00179  *
    00180  * Revision 1.12  2001/03/21 21:56:09  tng
    00181  * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
    00182  *
    00183  * Revision 1.11  2001/02/15 15:56:29  tng
    00184  * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
    00185  * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
    00186  * New data field  fSchemaValidation in XMLScanner as the flag.
    00187  *
    00188  * Revision 1.10  2001/01/12 21:23:41  tng
    00189  * Documentation Enhancement: explain values of Val_Scheme
    00190  *
    00191  * Revision 1.9  2000/08/02 18:05:15  jpolast
    00192  * changes required for sax2
    00193  * (changed private members to protected)
    00194  *
    00195  * Revision 1.8  2000/04/12 22:58:30  roddey
    00196  * Added support for 'auto validate' mode.
    00197  *
    00198  * Revision 1.7  2000/03/03 01:29:34  roddey
    00199  * Added a scanReset()/parseReset() method to the scanner and
    00200  * parsers, to allow for reset after early exit from a progressive parse.
    00201  * Added calls to new Terminate() call to all of the samples. Improved
    00202  * documentation in SAX and DOM parsers.
    00203  *
    00204  * Revision 1.6  2000/02/17 03:54:27  rahulj
    00205  * Added some new getters to query the parser state and
    00206  * clarified the documentation.
    00207  *
    00208  * Revision 1.5  2000/02/16 03:42:58  rahulj
    00209  * Finished documenting the SAX Driver implementation.
    00210  *
    00211  * Revision 1.4  2000/02/15 04:47:37  rahulj
    00212  * Documenting the SAXParser framework. Not done yet.
    00213  *
    00214  * Revision 1.3  2000/02/06 07:47:56  rahulj
    00215  * Year 2K copyright swat.
    00216  *
    00217  * Revision 1.2  1999/12/15 19:57:48  roddey
    00218  * Got rid of redundant 'const' on boolean return value. Some compilers choke
    00219  * on this and its useless.
    00220  *
    00221  * Revision 1.1.1.1  1999/11/09 01:07:51  twl
    00222  * Initial checkin
    00223  *
    00224  * Revision 1.6  1999/11/08 20:44:54  rahul
    00225  * Swat for adding in Product name and CVS comment log variable.
    00226  *
    00227  */
    00228
    00229 #if !defined(SAXPARSER_HPP)
    00230 #define SAXPARSER_HPP
    00231
    00232 #include <xercesc/sax/Parser.hpp>
    00233 #include <xercesc/internal/VecAttrListImpl.hpp>
    00234 #include <xercesc/framework/XMLDocumentHandler.hpp>
    00235 #include <xercesc/framework/XMLElementDecl.hpp>
    00236 #include <xercesc/framework/XMLEntityHandler.hpp>
    00237 #include <xercesc/framework/XMLErrorReporter.hpp>
    00238 #include <xercesc/framework/XMLBuffer.hpp>
    00239 #include <xercesc/util/SecurityManager.hpp>
    00240 #include <xercesc/validators/DTD/DocTypeHandler.hpp>
    00241
    00242 XERCES_CPP_NAMESPACE_BEGIN
    00243
    00244
    00245 class DocumentHandler;
    00246 class EntityResolver;
    00247 class XMLPScanToken;
    00248 class XMLScanner;
    00249 class XMLValidator;
    00250 class Grammar;
    00251 class GrammarResolver;
    00252
    00253
    00264 class  SAXParser :
    00265
    00266     public XMemory
    00267     , public Parser
    00268     , public XMLDocumentHandler
    00269     , public XMLErrorReporter
    00270     , public XMLEntityHandler
    00271     , public DocTypeHandler
    00272 {
    00273 public :
    00274     // -----------------------------------------------------------------------
    00275     //  Class types
    00276     // -----------------------------------------------------------------------
    00285     enum ValSchemes
    00286     {
    00287         Val_Never
    00288         , Val_Always
    00289         , Val_Auto
    00290     };
    00291
    00292
    00293     // -----------------------------------------------------------------------
    00294     //  Constructors and Destructor
    00295     // -----------------------------------------------------------------------
    00303     SAXParser
    00304     (
    00305           XMLValidator* const  valToAdopt = 0
    00306         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
    00307     );
    00308
    00312     ~SAXParser();
    00314
    00315
    00316     // -----------------------------------------------------------------------
    00317     //  Getter Methods
    00318     // -----------------------------------------------------------------------
    00327     DocumentHandler* getDocumentHandler();
    00328
    00335     const DocumentHandler* getDocumentHandler() const;
    00336
    00343     EntityResolver* getEntityResolver();
    00344
    00351     const EntityResolver* getEntityResolver() const;
    00352
    00359     ErrorHandler* getErrorHandler();
    00360
    00367     const ErrorHandler* getErrorHandler() const;
    00368
    00375     const XMLValidator& getValidator() const;
    00376
    00384     ValSchemes getValidationScheme() const;
    00385
    00396     bool getDoSchema() const;
    00397
    00408     bool getValidationSchemaFullChecking() const;
    00409
    00420     int getErrorCount() const;
    00421
    00431     bool getDoNamespaces() const;
    00432
    00442     bool getExitOnFirstFatalError() const;
    00443
    00454     bool getValidationConstraintFatal() const;
    00455
    00475     XMLCh* getExternalSchemaLocation() const;
    00476
    00496     XMLCh* getExternalNoNamespaceSchemaLocation() const;
    00497
    00513     SecurityManager* getSecurityManager() const;
    00514
    00526     bool getLoadExternalDTD() const;
    00527
    00538     bool isCachingGrammarFromParse() const;
    00539
    00550     bool isUsingCachedGrammarInParse() const;
    00551
    00563     bool getCalculateSrcOfs() const;
    00564
    00575     bool getStandardUriConformant() const;
    00576
    00583     Grammar* getGrammar(const XMLCh* const nameSpaceKey);
    00584
    00590     Grammar* getRootGrammar();
    00591
    00598     const XMLCh* getURIText(unsigned int uriId) const;
    00599
    00605     unsigned int getSrcOffset() const;
    00606
    00608
    00609
    00610     // -----------------------------------------------------------------------
    00611     //  Setter methods
    00612     // -----------------------------------------------------------------------
    00613
    00629     void setDoNamespaces(const bool newState);
    00630
    00647     void setValidationScheme(const ValSchemes newScheme);
    00648
    00664     void setDoSchema(const bool newState);
    00665
    00682     void setValidationSchemaFullChecking(const bool schemaFullChecking);
    00683
    00699     void setExitOnFirstFatalError(const bool newState);
    00700
    00720     void setValidationConstraintFatal(const bool newState);
    00721
    00742     void setExternalSchemaLocation(const XMLCh* const schemaLocation);
    00743
    00752     void setExternalSchemaLocation(const char* const schemaLocation);
    00753
    00768     void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
    00769
    00778     void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
    00779
    00795     void setSecurityManager(SecurityManager* const securityManager);
    00796
    00813     void setLoadExternalDTD(const bool newState);
    00814
    00832     void cacheGrammarFromParse(const bool newState);
    00833
    00852     void useCachedGrammarInParse(const bool newState);
    00853
    00866     void setCalculateSrcOfs(const bool newState);
    00867
    00878     void setStandardUriConformant(const bool newState);
    00879
    00887     void useScanner(const XMLCh* const scannerName);
    00888
    00890
    00891
    00892     // -----------------------------------------------------------------------
    00893     //  Advanced document handler list maintenance methods
    00894     // -----------------------------------------------------------------------
    00895
    00911     void installAdvDocHandler(XMLDocumentHandler* const toInstall);
    00912
    00922     bool removeAdvDocHandler(XMLDocumentHandler* const toRemove);
    00924
    00925
    00926     // -----------------------------------------------------------------------
    00927     //  Progressive scan methods
    00928     // -----------------------------------------------------------------------
    00929
    00932
    00960     bool parseFirst
    00961     (
    00962         const   XMLCh* const    systemId
    00963         ,       XMLPScanToken&  toFill
    00964     );
    00965
    00993     bool parseFirst
    00994     (
    00995         const   char* const     systemId
    00996         ,       XMLPScanToken&  toFill
    00997     );
    00998
    01026     bool parseFirst
    01027     (
    01028         const   InputSource&    source
    01029         ,       XMLPScanToken&  toFill
    01030     );
    01031
    01056     bool parseNext(XMLPScanToken& token);
    01057
    01079     void parseReset(XMLPScanToken& token);
    01080
    01082
    01083     // -----------------------------------------------------------------------
    01084     //  Grammar preparsing interface
    01085     // -----------------------------------------------------------------------
    01086
    01116     Grammar* loadGrammar(const InputSource& source,
    01117                          const short grammarType,
    01118                          const bool toCache = false);
    01119
    01145     Grammar* loadGrammar(const XMLCh* const systemId,
    01146                          const short grammarType,
    01147                          const bool toCache = false);
    01148
    01173     Grammar* loadGrammar(const char* const systemId,
    01174                          const short grammarType,
    01175                          const bool toCache = false);
    01176
    01180     void resetCachedGrammarPool();
    01181
    01183
    01184
    01185     // -----------------------------------------------------------------------
    01186     //  Implementation of the SAX Parser interface
    01187     // -----------------------------------------------------------------------
    01188
    01200     virtual void parse(const InputSource& source);
    01201
    01211     virtual void parse(const XMLCh* const systemId);
    01212
    01220     virtual void parse(const char* const systemId);
    01221
    01232     virtual void setDocumentHandler(DocumentHandler* const handler);
    01233
    01243     virtual void setDTDHandler(DTDHandler* const handler);
    01244
    01255     virtual void setErrorHandler(ErrorHandler* const handler);
    01256
    01268     virtual void setEntityResolver(EntityResolver* const resolver);
    01270
    01271
    01272     // -----------------------------------------------------------------------
    01273     //  Implementation of the XMLDocumentHandler interface
    01274     // -----------------------------------------------------------------------
    01275
    01293     virtual void docCharacters
    01294     (
    01295         const   XMLCh* const    chars
    01296         , const unsigned int    length
    01297         , const bool            cdataSection
    01298     );
    01299
    01309     virtual void docComment
    01310     (
    01311         const   XMLCh* const    comment
    01312     );
    01313
    01333     virtual void docPI
    01334     (
    01335         const   XMLCh* const    target
    01336         , const XMLCh* const    data
    01337     );
    01338
    01350     virtual void endDocument();
    01351
    01371     virtual void endElement
    01372     (
    01373         const   XMLElementDecl& elemDecl
    01374         , const unsigned int    urlId
    01375         , const bool            isRoot
    01376         , const XMLCh* const    elemPrefix
    01377     );
    01378
    01389     virtual void endEntityReference
    01390     (
    01391         const   XMLEntityDecl&  entDecl
    01392     );
    01393
    01413     virtual void ignorableWhitespace
    01414     (
    01415         const   XMLCh* const    chars
    01416         , const unsigned int    length
    01417         , const bool            cdataSection
    01418     );
    01419
    01424     virtual void resetDocument();
    01425
    01436     virtual void startDocument();
    01437
    01464     virtual void startElement
    01465     (
    01466         const   XMLElementDecl&         elemDecl
    01467         , const unsigned int            urlId
    01468         , const XMLCh* const            elemPrefix
    01469         , const RefVectorOf<XMLAttr>&   attrList
    01470         , const unsigned int            attrCount
    01471         , const bool                    isEmpty
    01472         , const bool                    isRoot
    01473     );
    01474
    01484     virtual void startEntityReference
    01485     (
    01486         const   XMLEntityDecl&  entDecl
    01487     );
    01488
    01506     virtual void XMLDecl
    01507     (
    01508         const   XMLCh* const    versionStr
    01509         , const XMLCh* const    encodingStr
    01510         , const XMLCh* const    standaloneStr
    01511         , const XMLCh* const    actualEncodingStr
    01512     );
    01514
    01515
    01516     // -----------------------------------------------------------------------
    01517     //  Implementation of the XMLErrorReporter interface
    01518     // -----------------------------------------------------------------------
    01519
    01545     virtual void error
    01546     (
    01547         const   unsigned int                errCode
    01548         , const XMLCh* const                msgDomain
    01549         , const XMLErrorReporter::ErrTypes  errType
    01550         , const XMLCh* const                errorText
    01551         , const XMLCh* const                systemId
    01552         , const XMLCh* const                publicId
    01553         , const XMLSSize_t                  lineNum
    01554         , const XMLSSize_t                  colNum
    01555     );
    01556
    01565     virtual void resetErrors();
    01567
    01568
    01569     // -----------------------------------------------------------------------
    01570     //  Implementation of the XMLEntityHandler interface
    01571     // -----------------------------------------------------------------------
    01572
    01586     virtual void endInputSource(const InputSource& inputSource);
    01587
    01602     virtual bool expandSystemId
    01603     (
    01604         const   XMLCh* const    systemId
    01605         ,       XMLBuffer&      toFill
    01606     );
    01607
    01615     virtual void resetEntities();
    01616
    01637     virtual InputSource* resolveEntity
    01638     (
    01639         const   XMLCh* const    publicId
    01640         , const XMLCh* const    systemId
    01641         , const XMLCh* const    baseURI = 0
    01642     );
    01643
    01655     virtual void startInputSource(const InputSource& inputSource);
    01657
    01658
    01659     // -----------------------------------------------------------------------
    01660     //  Implementation of the Deprecated DocTypeHandler Interface
    01661     // -----------------------------------------------------------------------
    01678     virtual void attDef
    01679     (
    01680         const   DTDElementDecl& elemDecl
    01681         , const DTDAttDef&      attDef
    01682         , const bool            ignore
    01683     );
    01684
    01694     virtual void doctypeComment
    01695     (
    01696         const   XMLCh* const    comment
    01697     );
    01698
    01717     virtual void doctypeDecl
    01718     (
    01719         const   DTDElementDecl& elemDecl
    01720         , const XMLCh* const    publicId
    01721         , const XMLCh* const    systemId
    01722         , const bool            hasIntSubset
    01723         , const bool            hasExtSubset = false
    01724     );
    01725
    01739     virtual void doctypePI
    01740     (
    01741         const   XMLCh* const    target
    01742         , const XMLCh* const    data
    01743     );
    01744
    01756     virtual void doctypeWhitespace
    01757     (
    01758         const   XMLCh* const    chars
    01759         , const unsigned int    length
    01760     );
    01761
    01774     virtual void elementDecl
    01775     (
    01776         const   DTDElementDecl& decl
    01777         , const bool            isIgnored
    01778     );
    01779
    01790     virtual void endAttList
    01791     (
    01792         const   DTDElementDecl& elemDecl
    01793     );
    01794
    01801     virtual void endIntSubset();
    01802
    01809     virtual void endExtSubset();
    01810
    01825     virtual void entityDecl
    01826     (
    01827         const   DTDEntityDecl&  entityDecl
    01828         , const bool            isPEDecl
    01829         , const bool            isIgnored
    01830     );
    01831
    01836     virtual void resetDocType();
    01837
    01850     virtual void notationDecl
    01851     (
    01852         const   XMLNotationDecl&    notDecl
    01853         , const bool                isIgnored
    01854     );
    01855
    01866     virtual void startAttList
    01867     (
    01868         const   DTDElementDecl& elemDecl
    01869     );
    01870
    01877     virtual void startIntSubset();
    01878
    01885     virtual void startExtSubset();
    01886
    01899     virtual void TextDecl
    01900     (
    01901         const   XMLCh* const    versionStr
    01902         , const XMLCh* const    encodingStr
    01903     );
    01905
    01906
    01907     // -----------------------------------------------------------------------
    01908     //  Deprecated Methods
    01909     // -----------------------------------------------------------------------
    01922     bool getDoValidation() const;
    01923
    01937     void setDoValidation(const bool newState);
    01939
    01940
    01941 protected :
    01942     // -----------------------------------------------------------------------
    01943     //  Protected Methods
    01944     // -----------------------------------------------------------------------
    01951     const XMLScanner& getScanner() const;
    01952
    01953
    01954 private:
    01955     // -----------------------------------------------------------------------
    01956     //  Unimplemented constructors and operators
    01957     // -----------------------------------------------------------------------
    01958     SAXParser(const SAXParser&);
    01959     SAXParser& operator=(const SAXParser&);
    01960
    01961     // -----------------------------------------------------------------------
    01962     //  Initialize/Cleanup methods
    01963     // -----------------------------------------------------------------------
    01964     void initialize();
    01965     void cleanUp();
    01966
    01967     // -----------------------------------------------------------------------
    01968     //  Private data members
    01969     //
    01970     //  fAttrList
    01971     //      A temporary implementation of the basic SAX attribute list
    01972     //      interface. We use this one over and over on each startElement
    01973     //      event to allow SAX-like access to the element attributes.
    01974     //
    01975     //  fDocHandler
    01976     //      The installed SAX doc handler, if any. Null if none.
    01977     //
    01978     //  fDTDHandler
    01979     //      The installed SAX DTD handler, if any. Null if none.
    01980     //
    01981     //  fElemDepth
    01982     //      This is used to track the element nesting depth, so that we can
    01983     //      know when we are inside content. This is so we can ignore char
    01984     //      data outside of content.
    01985     //
    01986     //  fEntityResolver
    01987     //      The installed SAX entity handler, if any. Null if none.
    01988     //
    01989     //  fErrorHandler
    01990     //      The installed SAX error handler, if any. Null if none.
    01991     //
    01992     //  fAdvDHCount
    01993     //  fAdvDHList
    01994     //  fAdvDHListSize
    01995     //      This is an array of pointers to XMLDocumentHandlers, which is
    01996     //      how we see installed advanced document handlers. There will
    01997     //      usually not be very many at all, so a simple array is used
    01998     //      instead of a collection, for performance. It will grow if needed,
    01999     //      but that is unlikely.
    02000     //
    02001     //      The count is how many handlers are currently installed. The size
    02002     //      is how big the array itself is (for expansion purposes.) When
    02003     //      count == size, is time to expand.
    02004     //
    02005     //  fParseInProgress
    02006     //      This flag is set once a parse starts. It is used to prevent
    02007     //      multiple entrance or reentrance of the parser.
    02008     //
    02009     //  fScanner
    02010     //      The scanner being used by this parser. It is created internally
    02011     //      during construction.
    02012     //
    02013     // -----------------------------------------------------------------------
    02014     bool                 fParseInProgress;
    02015     unsigned int         fElemDepth;
    02016     unsigned int         fAdvDHCount;
    02017     unsigned int         fAdvDHListSize;
    02018     VecAttrListImpl      fAttrList;
    02019     DocumentHandler*     fDocHandler;
    02020     DTDHandler*          fDTDHandler;
    02021     EntityResolver*      fEntityResolver;
    02022     ErrorHandler*        fErrorHandler;
    02023     XMLDocumentHandler** fAdvDHList;
    02024     XMLScanner*          fScanner;
    02025     GrammarResolver*     fGrammarResolver;
    02026     XMLStringPool*       fURIStringPool;
    02027     XMLValidator*        fValidator;
    02028     MemoryManager*       fMemoryManager;
    02029     XMLBuffer            fElemQNameBuf;
    02030 };
    02031
    02032
    02033 // ---------------------------------------------------------------------------
    02034 //  SAXParser: Getter methods
    02035 // ---------------------------------------------------------------------------
    02036 inline DocumentHandler* SAXParser::getDocumentHandler()
    02037 {
    02038     return fDocHandler;
    02039 }
    02040
    02041 inline const DocumentHandler* SAXParser::getDocumentHandler() const
    02042 {
    02043     return fDocHandler;
    02044 }
    02045
    02046 inline EntityResolver* SAXParser::getEntityResolver()
    02047 {
    02048     return fEntityResolver;
    02049 }
    02050
    02051 inline const EntityResolver* SAXParser::getEntityResolver() const
    02052 {
    02053     return fEntityResolver;
    02054 }
    02055
    02056 inline ErrorHandler* SAXParser::getErrorHandler()
    02057 {
    02058     return fErrorHandler;
    02059 }
    02060
    02061 inline const ErrorHandler* SAXParser::getErrorHandler() const
    02062 {
    02063     return fErrorHandler;
    02064 }
    02065
    02066 inline const XMLScanner& SAXParser::getScanner() const
    02067 {
    02068     return *fScanner;
    02069 }
    02070
    02071 XERCES_CPP_NAMESPACE_END
    02072
    02073 #endif

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