| 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.28  2003/12/01 23:23:26  neilg
    00060  * fix for bug 25118; thanks to Jeroen Witmond
    00061  *
    00062  * Revision 1.27  2003/11/06 15:30:07  neilg
    00063  * first part of PSVI/schema component model implementation, thanks to David Cargill.  This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse.
    00064  *
    00065  * Revision 1.26  2003/10/30 21:37:31  knoaman
    00066  * Enhanced Entity Resolver Support. Thanks to David Cargill.
    00067  *
    00068  * Revision 1.25  2003/10/20 13:41:10  amassari
    00069  * Added getGrammarResolver API
    00070  *
    00071  * Revision 1.24  2003/06/20 18:55:54  peiyongz
    00072  * Stateless Grammar Pool :: Part I
    00073  *
    00074  * Revision 1.23  2003/05/15 18:26:50  knoaman
    00075  * Partial implementation of the configurable memory manager.
    00076  *
    00077  * Revision 1.22  2003/04/17 21:58:50  neilg
    00078  * Adding a new property,
    00079  * http://apache.org/xml/properties/security-manager, with
    00080  * appropriate getSecurityManager/setSecurityManager methods on DOM
    00081  * and SAX parsers.  Also adding a new SecurityManager class.
    00082  *
    00083  * The purpose of these modifications is to permit applications a
    00084  * means to have the parser reject documents whose processing would
    00085  * otherwise consume large amounts of system resources.  Malicious
    00086  * use of such documents could be used to launch a denial-of-service
    00087  * attack against a system running the parser.  Initially, the
    00088  * SecurityManager only knows about attacks that can result from
    00089  * exponential entity expansion; this is the only known attack that
    00090  * involves processing a single XML document.  Other, simlar attacks
    00091  * can be launched if arbitrary schemas may be parsed; there already
    00092  * exist means (via use of the EntityResolver interface) by which
    00093  * applications can deny processing of untrusted schemas.  In future,
    00094  * the SecurityManager will be expanded to take these other exploits
    00095  * into account.
    00096  *
    00097  * Add support for the SecurityManager
    00098  *
    00099  * Revision 1.21  2003/03/07 18:09:17  tng
    00100  * Return a reference instead of void for operator=
    00101  *
    00102  * Revision 1.20  2003/02/04 19:27:43  knoaman
    00103  * Performance: use global buffer to eliminate repetitive memory creation/deletion.
    00104  *
    00105  * Revision 1.19  2003/01/09 19:07:08  tng
    00106  * [Bug 15802] Add "const" qualifier to getURIText.
    00107  *
    00108  * Revision 1.18  2003/01/03 20:09:36  tng
    00109  * New feature StandardUriConformant to force strict standard uri conformance.
    00110  *
    00111  * Revision 1.17  2002/12/30 20:15:51  knoaman
    00112  * Make calculate src offset option false by default.
    00113  *
    00114  * Revision 1.16  2002/12/23 15:23:18  knoaman
    00115  * Added a public api to various parsers to return the src offset within the input
    00116  * source.
    00117  *
    00118  * Revision 1.15  2002/12/04 01:57:09  knoaman
    00119  * Scanner re-organization.
    00120  *
    00121  * Revision 1.14  2002/11/04 14:57:03  tng
    00122  * C++ Namespace Support.
    00123  *
    00124  * Revision 1.13  2002/08/14 15:20:38  knoaman
    00125  * [Bug 3111] Problem with LexicalHandler::startDTD() and LexicalHandler::endDTD().
    00126  *
    00127  * Revision 1.12  2002/07/11 18:27:03  knoaman
    00128  * Grammar caching/preparsing - initial implementation.
    00129  *
    00130  * Revision 1.11  2002/06/27 18:48:04  tng
    00131  * API Documentation Update and move getScanner as protected
    00132  *
    00133  * Revision 1.10  2002/06/17 15:41:44  tng
    00134  * Update API Documentation
    00135  *
    00136  * Revision 1.9  2002/06/06 20:38:18  tng
    00137  * Document Fix: document that the returned object from resolveEntity is owned by the parser
    00138  *
    00139  * Revision 1.8  2002/05/31 15:13:53  tng
    00140  * Fix doxygen documentation.
    00141  *
    00142  * Revision 1.7  2002/05/30 16:39:06  knoaman
    00143  * DOM L3 LS.
    00144  *
    00145  * Revision 1.6  2002/05/30 16:20:09  tng
    00146  * Add feature to optionally ignore external DTD.
    00147  *
    00148  * Revision 1.5  2002/05/29 21:37:47  knoaman
    00149  * Add baseURI to resolveEntity to support DOMInputSource.
    00150  *
    00151  * Revision 1.4  2002/05/28 20:44:14  tng
    00152  * [Bug 9104] prefixes dissapearing when schema validation turned on.
    00153  *
    00154  * Revision 1.3  2002/05/27 18:39:21  tng
    00155  * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
    00156  *
    00157  * Revision 1.2  2002/02/20 18:17:01  tng
    00158  * [Bug 5977] Warnings on generating apiDocs.
    00159  *
    00160  * Revision 1.1.1.1  2002/02/01 22:22:07  peiyongz
    00161  * sane_include
    00162  *
    00163  * Revision 1.22  2001/12/05 22:09:02  tng
    00164  * Update documentation for setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation.
    00165  *
    00166  * Revision 1.21  2001/11/20 18:51:44  tng
    00167  * 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).
    00168  *
    00169  * Revision 1.20  2001/08/01 19:11:02  tng
    00170  * Add full schema constraint checking flag to the samples and the parser.
    00171  *
    00172  * Revision 1.19  2001/07/27 20:24:21  tng
    00173  * put getScanner() back as they were there before, not to break existing apps.
    00174  *
    00175  * Revision 1.18  2001/07/16 12:52:09  tng
    00176  * APIDocs fix: default for schema processing in DOMParser, IDOMParser, and SAXParser should be false.
    00177  *
    00178  * Revision 1.17  2001/06/23 14:13:16  tng
    00179  * Remove getScanner from the Parser headers as this is not needed and Scanner is not internal class.
    00180  *
    00181  * Revision 1.16  2001/06/03 19:26:20  jberry
    00182  * Add support for querying error count following parse; enables simple parse without requiring error handler.
    00183  *
    00184  * Revision 1.15  2001/05/11 13:26:22  tng
    00185  * Copyright update.
    00186  *
    00187  * Revision 1.14  2001/05/03 19:09:25  knoaman
    00188  * Support Warning/Error/FatalError messaging.
    00189  * Validity constraints errors are treated as errors, with the ability by user to set
    00190  * validity constraints as fatal errors.
    00191  *
    00192  * Revision 1.13  2001/03/30 16:46:57  tng
    00193  * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
    00194  *
    00195  * Revision 1.12  2001/03/21 21:56:09  tng
    00196  * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
    00197  *
    00198  * Revision 1.11  2001/02/15 15:56:29  tng
    00199  * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
    00200  * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
    00201  * New data field  fSchemaValidation in XMLScanner as the flag.
    00202  *
    00203  * Revision 1.10  2001/01/12 21:23:41  tng
    00204  * Documentation Enhancement: explain values of Val_Scheme
    00205  *
    00206  * Revision 1.9  2000/08/02 18:05:15  jpolast
    00207  * changes required for sax2
    00208  * (changed private members to protected)
    00209  *
    00210  * Revision 1.8  2000/04/12 22:58:30  roddey
    00211  * Added support for 'auto validate' mode.
    00212  *
    00213  * Revision 1.7  2000/03/03 01:29:34  roddey
    00214  * Added a scanReset()/parseReset() method to the scanner and
    00215  * parsers, to allow for reset after early exit from a progressive parse.
    00216  * Added calls to new Terminate() call to all of the samples. Improved
    00217  * documentation in SAX and DOM parsers.
    00218  *
    00219  * Revision 1.6  2000/02/17 03:54:27  rahulj
    00220  * Added some new getters to query the parser state and
    00221  * clarified the documentation.
    00222  *
    00223  * Revision 1.5  2000/02/16 03:42:58  rahulj
    00224  * Finished documenting the SAX Driver implementation.
    00225  *
    00226  * Revision 1.4  2000/02/15 04:47:37  rahulj
    00227  * Documenting the SAXParser framework. Not done yet.
    00228  *
    00229  * Revision 1.3  2000/02/06 07:47:56  rahulj
    00230  * Year 2K copyright swat.
    00231  *
    00232  * Revision 1.2  1999/12/15 19:57:48  roddey
    00233  * Got rid of redundant 'const' on boolean return value. Some compilers choke
    00234  * on this and its useless.
    00235  *
    00236  * Revision 1.1.1.1  1999/11/09 01:07:51  twl
    00237  * Initial checkin
    00238  *
    00239  * Revision 1.6  1999/11/08 20:44:54  rahul
    00240  * Swat for adding in Product name and CVS comment log variable.
    00241  *
    00242  */
    00243
    00244 #if !defined(SAXPARSER_HPP)
    00245 #define SAXPARSER_HPP
    00246
    00247 #include <xercesc/sax/Parser.hpp>
    00248 #include <xercesc/internal/VecAttrListImpl.hpp>
    00249 #include <xercesc/framework/XMLDocumentHandler.hpp>
    00250 #include <xercesc/framework/XMLElementDecl.hpp>
    00251 #include <xercesc/framework/XMLEntityHandler.hpp>
    00252 #include <xercesc/framework/XMLErrorReporter.hpp>
    00253 #include <xercesc/framework/XMLBuffer.hpp>
    00254 #include <xercesc/util/SecurityManager.hpp>
    00255 #include <xercesc/validators/DTD/DocTypeHandler.hpp>
    00256
    00257 XERCES_CPP_NAMESPACE_BEGIN
    00258
    00259
    00260 class DocumentHandler;
    00261 class EntityResolver;
    00262 class XMLPScanToken;
    00263 class XMLScanner;
    00264 class XMLValidator;
    00265 class Grammar;
    00266 class GrammarResolver;
    00267 class XMLGrammarPool;
    00268 class XMLEntityResolver;
    00269 class XMLResourceIdentifier;
    00270 class PSVIHandler;
    00271
    00282 class  SAXParser :
    00283
    00284     public XMemory
    00285     , public Parser
    00286     , public XMLDocumentHandler
    00287     , public XMLErrorReporter
    00288     , public XMLEntityHandler
    00289     , public DocTypeHandler
    00290 {
    00291 public :
    00292     // -----------------------------------------------------------------------
    00293     //  Class types
    00294     // -----------------------------------------------------------------------
    00303     enum ValSchemes
    00304     {
    00305         Val_Never
    00306         , Val_Always
    00307         , Val_Auto
    00308     };
    00309
    00310
    00311     // -----------------------------------------------------------------------
    00312     //  Constructors and Destructor
    00313     // -----------------------------------------------------------------------
    00324     SAXParser
    00325     (
    00326           XMLValidator*   const valToAdopt = 0
    00327         , MemoryManager*  const manager = XMLPlatformUtils::fgMemoryManager
    00328         , XMLGrammarPool* const gramPool = 0
    00329     );
    00330
    00334     ~SAXParser();
    00336
    00337
    00338     // -----------------------------------------------------------------------
    00339     //  Getter Methods
    00340     // -----------------------------------------------------------------------
    00349     DocumentHandler* getDocumentHandler();
    00350
    00357     const DocumentHandler* getDocumentHandler() const;
    00358
    00365     EntityResolver* getEntityResolver();
    00366
    00373     const EntityResolver* getEntityResolver() const;
    00374
    00381     XMLEntityResolver* getXMLEntityResolver();
    00382
    00389     const XMLEntityResolver* getXMLEntityResolver() const;
    00390
    00397     ErrorHandler* getErrorHandler();
    00398
    00405     const ErrorHandler* getErrorHandler() const;
    00406
    00413     PSVIHandler* getPSVIHandler();
    00414
    00421     const PSVIHandler* getPSVIHandler() const;
    00422
    00429     const XMLValidator& getValidator() const;
    00430
    00438     ValSchemes getValidationScheme() const;
    00439
    00450     bool getDoSchema() const;
    00451
    00462     bool getValidationSchemaFullChecking() const;
    00463
    00474     int getErrorCount() const;
    00475
    00485     bool getDoNamespaces() const;
    00486
    00496     bool getExitOnFirstFatalError() const;
    00497
    00508     bool getValidationConstraintFatal() const;
    00509
    00529     XMLCh* getExternalSchemaLocation() const;
    00530
    00550     XMLCh* getExternalNoNamespaceSchemaLocation() const;
    00551
    00567     SecurityManager* getSecurityManager() const;
    00568
    00580     bool getLoadExternalDTD() const;
    00581
    00592     bool isCachingGrammarFromParse() const;
    00593
    00604     bool isUsingCachedGrammarInParse() const;
    00605
    00617     bool getCalculateSrcOfs() const;
    00618
    00629     bool getStandardUriConformant() const;
    00630
    00637     Grammar* getGrammar(const XMLCh* const nameSpaceKey);
    00638
    00644     Grammar* getRootGrammar();
    00645
    00652     const XMLCh* getURIText(unsigned int uriId) const;
    00653
    00659     unsigned int getSrcOffset() const;
    00660
    00662
    00663
    00664     // -----------------------------------------------------------------------
    00665     //  Setter methods
    00666     // -----------------------------------------------------------------------
    00667
    00683     void setDoNamespaces(const bool newState);
    00684
    00701     void setValidationScheme(const ValSchemes newScheme);
    00702
    00718     void setDoSchema(const bool newState);
    00719
    00736     void setValidationSchemaFullChecking(const bool schemaFullChecking);
    00737
    00753     void setExitOnFirstFatalError(const bool newState);
    00754
    00774     void setValidationConstraintFatal(const bool newState);
    00775
    00796     void setExternalSchemaLocation(const XMLCh* const schemaLocation);
    00797
    00806     void setExternalSchemaLocation(const char* const schemaLocation);
    00807
    00822     void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
    00823
    00832     void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
    00833
    00849     void setSecurityManager(SecurityManager* const securityManager);
    00850
    00867     void setLoadExternalDTD(const bool newState);
    00868
    00886     void cacheGrammarFromParse(const bool newState);
    00887
    00906     void useCachedGrammarInParse(const bool newState);
    00907
    00920     void setCalculateSrcOfs(const bool newState);
    00921
    00932     void setStandardUriConformant(const bool newState);
    00933
    00941     void useScanner(const XMLCh* const scannerName);
    00942
    00944
    00945
    00946     // -----------------------------------------------------------------------
    00947     //  Advanced document handler list maintenance methods
    00948     // -----------------------------------------------------------------------
    00949
    00965     void installAdvDocHandler(XMLDocumentHandler* const toInstall);
    00966
    00976     bool removeAdvDocHandler(XMLDocumentHandler* const toRemove);
    00978
    00979
    00980     // -----------------------------------------------------------------------
    00981     //  Progressive scan methods
    00982     // -----------------------------------------------------------------------
    00983
    00986
    01014     bool parseFirst
    01015     (
    01016         const   XMLCh* const    systemId
    01017         ,       XMLPScanToken&  toFill
    01018     );
    01019
    01047     bool parseFirst
    01048     (
    01049         const   char* const     systemId
    01050         ,       XMLPScanToken&  toFill
    01051     );
    01052
    01080     bool parseFirst
    01081     (
    01082         const   InputSource&    source
    01083         ,       XMLPScanToken&  toFill
    01084     );
    01085
    01110     bool parseNext(XMLPScanToken& token);
    01111
    01133     void parseReset(XMLPScanToken& token);
    01134
    01136
    01137     // -----------------------------------------------------------------------
    01138     //  Grammar preparsing interface
    01139     // -----------------------------------------------------------------------
    01140
    01170     Grammar* loadGrammar(const InputSource& source,
    01171                          const short grammarType,
    01172                          const bool toCache = false);
    01173
    01199     Grammar* loadGrammar(const XMLCh* const systemId,
    01200                          const short grammarType,
    01201                          const bool toCache = false);
    01202
    01227     Grammar* loadGrammar(const char* const systemId,
    01228                          const short grammarType,
    01229                          const bool toCache = false);
    01230
    01234     void resetCachedGrammarPool();
    01235
    01237
    01238
    01239     // -----------------------------------------------------------------------
    01240     //  Implementation of the SAX Parser interface
    01241     // -----------------------------------------------------------------------
    01242
    01254     virtual void parse(const InputSource& source);
    01255
    01265     virtual void parse(const XMLCh* const systemId);
    01266
    01274     virtual void parse(const char* const systemId);
    01275
    01286     virtual void setDocumentHandler(DocumentHandler* const handler);
    01287
    01297     virtual void setDTDHandler(DTDHandler* const handler);
    01298
    01309     virtual void setErrorHandler(ErrorHandler* const handler);
    01310
    01321     virtual void setPSVIHandler(PSVIHandler* const handler);
    01322
    01338     virtual void setEntityResolver(EntityResolver* const resolver);
    01339
    01355     virtual void setXMLEntityResolver(XMLEntityResolver* const resolver);
    01356
    01358
    01359
    01360     // -----------------------------------------------------------------------
    01361     //  Implementation of the XMLDocumentHandler interface
    01362     // -----------------------------------------------------------------------
    01363
    01381     virtual void docCharacters
    01382     (
    01383         const   XMLCh* const    chars
    01384         , const unsigned int    length
    01385         , const bool            cdataSection
    01386     );
    01387
    01397     virtual void docComment
    01398     (
    01399         const   XMLCh* const    comment
    01400     );
    01401
    01421     virtual void docPI
    01422     (
    01423         const   XMLCh* const    target
    01424         , const XMLCh* const    data
    01425     );
    01426
    01438     virtual void endDocument();
    01439
    01459     virtual void endElement
    01460     (
    01461         const   XMLElementDecl& elemDecl
    01462         , const unsigned int    urlId
    01463         , const bool            isRoot
    01464         , const XMLCh* const    elemPrefix
    01465     );
    01466
    01477     virtual void endEntityReference
    01478     (
    01479         const   XMLEntityDecl&  entDecl
    01480     );
    01481
    01501     virtual void ignorableWhitespace
    01502     (
    01503         const   XMLCh* const    chars
    01504         , const unsigned int    length
    01505         , const bool            cdataSection
    01506     );
    01507
    01512     virtual void resetDocument();
    01513
    01524     virtual void startDocument();
    01525
    01552     virtual void startElement
    01553     (
    01554         const   XMLElementDecl&         elemDecl
    01555         , const unsigned int            urlId
    01556         , const XMLCh* const            elemPrefix
    01557         , const RefVectorOf<XMLAttr>&   attrList
    01558         , const unsigned int            attrCount
    01559         , const bool                    isEmpty
    01560         , const bool                    isRoot
    01561     );
    01562
    01572     virtual void startEntityReference
    01573     (
    01574         const   XMLEntityDecl&  entDecl
    01575     );
    01576
    01594     virtual void XMLDecl
    01595     (
    01596         const   XMLCh* const    versionStr
    01597         , const XMLCh* const    encodingStr
    01598         , const XMLCh* const    standaloneStr
    01599         , const XMLCh* const    actualEncodingStr
    01600     );
    01602
    01603
    01604     // -----------------------------------------------------------------------
    01605     //  Implementation of the XMLErrorReporter interface
    01606     // -----------------------------------------------------------------------
    01607
    01633     virtual void error
    01634     (
    01635         const   unsigned int                errCode
    01636         , const XMLCh* const                msgDomain
    01637         , const XMLErrorReporter::ErrTypes  errType
    01638         , const XMLCh* const                errorText
    01639         , const XMLCh* const                systemId
    01640         , const XMLCh* const                publicId
    01641         , const XMLSSize_t                  lineNum
    01642         , const XMLSSize_t                  colNum
    01643     );
    01644
    01653     virtual void resetErrors();
    01655
    01656
    01657     // -----------------------------------------------------------------------
    01658     //  Implementation of the XMLEntityHandler interface
    01659     // -----------------------------------------------------------------------
    01660
    01674     virtual void endInputSource(const InputSource& inputSource);
    01675
    01690     virtual bool expandSystemId
    01691     (
    01692         const   XMLCh* const    systemId
    01693         ,       XMLBuffer&      toFill
    01694     );
    01695
    01703     virtual void resetEntities();
    01704
    01727     virtual InputSource* resolveEntity
    01728     (
    01729         const   XMLCh* const    publicId
    01730         , const XMLCh* const    systemId
    01731         , const XMLCh* const    baseURI = 0
    01732     );
    01733
    01750     virtual InputSource* resolveEntity
    01751     (
    01752         XMLResourceIdentifier* resourceIdentifier
    01753     );
    01754
    01766     virtual void startInputSource(const InputSource& inputSource);
    01768
    01769
    01770     // -----------------------------------------------------------------------
    01771     //  Implementation of the Deprecated DocTypeHandler Interface
    01772     // -----------------------------------------------------------------------
    01789     virtual void attDef
    01790     (
    01791         const   DTDElementDecl& elemDecl
    01792         , const DTDAttDef&      attDef
    01793         , const bool            ignore
    01794     );
    01795
    01805     virtual void doctypeComment
    01806     (
    01807         const   XMLCh* const    comment
    01808     );
    01809
    01828     virtual void doctypeDecl
    01829     (
    01830         const   DTDElementDecl& elemDecl
    01831         , const XMLCh* const    publicId
    01832         , const XMLCh* const    systemId
    01833         , const bool            hasIntSubset
    01834         , const bool            hasExtSubset = false
    01835     );
    01836
    01850     virtual void doctypePI
    01851     (
    01852         const   XMLCh* const    target
    01853         , const XMLCh* const    data
    01854     );
    01855
    01867     virtual void doctypeWhitespace
    01868     (
    01869         const   XMLCh* const    chars
    01870         , const unsigned int    length
    01871     );
    01872
    01885     virtual void elementDecl
    01886     (
    01887         const   DTDElementDecl& decl
    01888         , const bool            isIgnored
    01889     );
    01890
    01901     virtual void endAttList
    01902     (
    01903         const   DTDElementDecl& elemDecl
    01904     );
    01905
    01912     virtual void endIntSubset();
    01913
    01920     virtual void endExtSubset();
    01921
    01936     virtual void entityDecl
    01937     (
    01938         const   DTDEntityDecl&  entityDecl
    01939         , const bool            isPEDecl
    01940         , const bool            isIgnored
    01941     );
    01942
    01947     virtual void resetDocType();
    01948
    01961     virtual void notationDecl
    01962     (
    01963         const   XMLNotationDecl&    notDecl
    01964         , const bool                isIgnored
    01965     );
    01966
    01977     virtual void startAttList
    01978     (
    01979         const   DTDElementDecl& elemDecl
    01980     );
    01981
    01988     virtual void startIntSubset();
    01989
    01996     virtual void startExtSubset();
    01997
    02010     virtual void TextDecl
    02011     (
    02012         const   XMLCh* const    versionStr
    02013         , const XMLCh* const    encodingStr
    02014     );
    02016
    02017
    02018     // -----------------------------------------------------------------------
    02019     //  Deprecated Methods
    02020     // -----------------------------------------------------------------------
    02033     bool getDoValidation() const;
    02034
    02048     void setDoValidation(const bool newState);
    02050
    02051
    02052 protected :
    02053     // -----------------------------------------------------------------------
    02054     //  Protected Methods
    02055     // -----------------------------------------------------------------------
    02062     const XMLScanner& getScanner() const;
    02063
    02068     GrammarResolver* getGrammarResolver() const;
    02069
    02070
    02071 private:
    02072     // -----------------------------------------------------------------------
    02073     //  Unimplemented constructors and operators
    02074     // -----------------------------------------------------------------------
    02075     SAXParser(const SAXParser&);
    02076     SAXParser& operator=(const SAXParser&);
    02077
    02078     // -----------------------------------------------------------------------
    02079     //  Initialize/Cleanup methods
    02080     // -----------------------------------------------------------------------
    02081     void initialize();
    02082     void cleanUp();
    02083
    02084     // -----------------------------------------------------------------------
    02085     //  Private data members
    02086     //
    02087     //  fAttrList
    02088     //      A temporary implementation of the basic SAX attribute list
    02089     //      interface. We use this one over and over on each startElement
    02090     //      event to allow SAX-like access to the element attributes.
    02091     //
    02092     //  fDocHandler
    02093     //      The installed SAX doc handler, if any. Null if none.
    02094     //
    02095     //  fDTDHandler
    02096     //      The installed SAX DTD handler, if any. Null if none.
    02097     //
    02098     //  fElemDepth
    02099     //      This is used to track the element nesting depth, so that we can
    02100     //      know when we are inside content. This is so we can ignore char
    02101     //      data outside of content.
    02102     //
    02103     //  fEntityResolver
    02104     //      The installed SAX entity handler, if any. Null if none.
    02105     //
    02106     //  fErrorHandler
    02107     //      The installed SAX error handler, if any. Null if none.
    02108     //
    02109     //  fPSVIHandler
    02110     //      The installed PSVI handler, if any. Null if none.
    02111     //
    02112     //  fAdvDHCount
    02113     //  fAdvDHList
    02114     //  fAdvDHListSize
    02115     //      This is an array of pointers to XMLDocumentHandlers, which is
    02116     //      how we see installed advanced document handlers. There will
    02117     //      usually not be very many at all, so a simple array is used
    02118     //      instead of a collection, for performance. It will grow if needed,
    02119     //      but that is unlikely.
    02120     //
    02121     //      The count is how many handlers are currently installed. The size
    02122     //      is how big the array itself is (for expansion purposes.) When
    02123     //      count == size, is time to expand.
    02124     //
    02125     //  fParseInProgress
    02126     //      This flag is set once a parse starts. It is used to prevent
    02127     //      multiple entrance or reentrance of the parser.
    02128     //
    02129     //  fScanner
    02130     //      The scanner being used by this parser. It is created internally
    02131     //      during construction.
    02132     //
    02133     //   fGrammarPool
    02134     //      The grammar pool passed from external application (through derivatives).
    02135     //      which could be 0, not owned.
    02136     //
    02137     // -----------------------------------------------------------------------
    02138     bool                 fParseInProgress;
    02139     unsigned int         fElemDepth;
    02140     unsigned int         fAdvDHCount;
    02141     unsigned int         fAdvDHListSize;
    02142     VecAttrListImpl      fAttrList;
    02143     DocumentHandler*     fDocHandler;
    02144     DTDHandler*          fDTDHandler;
    02145     EntityResolver*      fEntityResolver;
    02146     XMLEntityResolver*   fXMLEntityResolver;
    02147     ErrorHandler*        fErrorHandler;
    02148     PSVIHandler*         fPSVIHandler;
    02149     XMLDocumentHandler** fAdvDHList;
    02150     XMLScanner*          fScanner;
    02151     GrammarResolver*     fGrammarResolver;
    02152     XMLStringPool*       fURIStringPool;
    02153     XMLValidator*        fValidator;
    02154     MemoryManager*       fMemoryManager;
    02155     XMLGrammarPool*      fGrammarPool;
    02156     XMLBuffer            fElemQNameBuf;
    02157 };
    02158
    02159
    02160 // ---------------------------------------------------------------------------
    02161 //  SAXParser: Getter methods
    02162 // ---------------------------------------------------------------------------
    02163 inline DocumentHandler* SAXParser::getDocumentHandler()
    02164 {
    02165     return fDocHandler;
    02166 }
    02167
    02168 inline const DocumentHandler* SAXParser::getDocumentHandler() const
    02169 {
    02170     return fDocHandler;
    02171 }
    02172
    02173 inline EntityResolver* SAXParser::getEntityResolver()
    02174 {
    02175     return fEntityResolver;
    02176 }
    02177
    02178 inline XMLEntityResolver* SAXParser::getXMLEntityResolver()
    02179 {
    02180     return fXMLEntityResolver;
    02181 }
    02182
    02183 inline const XMLEntityResolver* SAXParser::getXMLEntityResolver() const
    02184 {
    02185     return fXMLEntityResolver;
    02186 }
    02187
    02188 inline const EntityResolver* SAXParser::getEntityResolver() const
    02189 {
    02190     return fEntityResolver;
    02191 }
    02192
    02193 inline ErrorHandler* SAXParser::getErrorHandler()
    02194 {
    02195     return fErrorHandler;
    02196 }
    02197
    02198 inline const ErrorHandler* SAXParser::getErrorHandler() const
    02199 {
    02200     return fErrorHandler;
    02201 }
    02202
    02203 inline PSVIHandler* SAXParser::getPSVIHandler()
    02204 {
    02205     return fPSVIHandler;
    02206 }
    02207
    02208 inline const PSVIHandler* SAXParser::getPSVIHandler() const
    02209 {
    02210     return fPSVIHandler;
    02211 }
    02212
    02213 inline const XMLScanner& SAXParser::getScanner() const
    02214 {
    02215     return *fScanner;
    02216 }
    02217
    02218 inline GrammarResolver* SAXParser::getGrammarResolver() const
    02219 {
    02220     return fGrammarResolver;
    02221 }
    02222
    02223 XERCES_CPP_NAMESPACE_END
    02224
    02225 #endif

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