| 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  * Copyright 1999-2004 The Apache Software Foundation.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *      http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 /*
    00018  * $Log: SAXParser.hpp,v $
    00019  * Revision 1.36  2004/09/29 19:28:12  cargilld
    00020  * Mark SAXParser as deprecated.
    00021  *
    00022  * Revision 1.35  2004/09/29 19:00:29  peiyongz
    00023  * [jira1207] --patch from Dan Rosen
    00024  *
    00025  * Revision 1.34  2004/09/28 02:14:14  cargilld
    00026  * Add support for validating annotations.
    00027  *
    00028  * Revision 1.33  2004/09/23 01:09:55  cargilld
    00029  * Add support for generating synthetic XSAnnotations.  When a schema component has non-schema attributes and no child attributes create a synthetic XSAnnotation (under feature control) so the non-schema attributes can be recovered under PSVI.
    00030  *
    00031  * Revision 1.32  2004/09/08 13:56:18  peiyongz
    00032  * Apache License Version 2.0
    00033  *
    00034  * Revision 1.31  2004/09/02 19:08:09  cargilld
    00035  * Fix API Doc warning message
    00036  *
    00037  * Revision 1.30  2004/04/13 18:58:36  peiyongz
    00038  * correct comment
    00039  *
    00040  * Revision 1.29  2004/04/13 16:53:26  peiyongz
    00041  * get/setIdentityConstraintChecking
    00042  *
    00043  * Revision 1.28  2003/12/01 23:23:26  neilg
    00044  * fix for bug 25118; thanks to Jeroen Witmond
    00045  *
    00046  * Revision 1.27  2003/11/06 15:30:07  neilg
    00047  * 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.
    00048  *
    00049  * Revision 1.26  2003/10/30 21:37:31  knoaman
    00050  * Enhanced Entity Resolver Support. Thanks to David Cargill.
    00051  *
    00052  * Revision 1.25  2003/10/20 13:41:10  amassari
    00053  * Added getGrammarResolver API
    00054  *
    00055  * Revision 1.24  2003/06/20 18:55:54  peiyongz
    00056  * Stateless Grammar Pool :: Part I
    00057  *
    00058  * Revision 1.23  2003/05/15 18:26:50  knoaman
    00059  * Partial implementation of the configurable memory manager.
    00060  *
    00061  * Revision 1.22  2003/04/17 21:58:50  neilg
    00062  * Adding a new property,
    00063  * http://apache.org/xml/properties/security-manager, with
    00064  * appropriate getSecurityManager/setSecurityManager methods on DOM
    00065  * and SAX parsers.  Also adding a new SecurityManager class.
    00066  *
    00067  * The purpose of these modifications is to permit applications a
    00068  * means to have the parser reject documents whose processing would
    00069  * otherwise consume large amounts of system resources.  Malicious
    00070  * use of such documents could be used to launch a denial-of-service
    00071  * attack against a system running the parser.  Initially, the
    00072  * SecurityManager only knows about attacks that can result from
    00073  * exponential entity expansion; this is the only known attack that
    00074  * involves processing a single XML document.  Other, simlar attacks
    00075  * can be launched if arbitrary schemas may be parsed; there already
    00076  * exist means (via use of the EntityResolver interface) by which
    00077  * applications can deny processing of untrusted schemas.  In future,
    00078  * the SecurityManager will be expanded to take these other exploits
    00079  * into account.
    00080  *
    00081  * Add support for the SecurityManager
    00082  *
    00083  * Revision 1.21  2003/03/07 18:09:17  tng
    00084  * Return a reference instead of void for operator=
    00085  *
    00086  * Revision 1.20  2003/02/04 19:27:43  knoaman
    00087  * Performance: use global buffer to eliminate repetitive memory creation/deletion.
    00088  *
    00089  * Revision 1.19  2003/01/09 19:07:08  tng
    00090  * [Bug 15802] Add "const" qualifier to getURIText.
    00091  *
    00092  * Revision 1.18  2003/01/03 20:09:36  tng
    00093  * New feature StandardUriConformant to force strict standard uri conformance.
    00094  *
    00095  * Revision 1.17  2002/12/30 20:15:51  knoaman
    00096  * Make calculate src offset option false by default.
    00097  *
    00098  * Revision 1.16  2002/12/23 15:23:18  knoaman
    00099  * Added a public api to various parsers to return the src offset within the input
    00100  * source.
    00101  *
    00102  * Revision 1.15  2002/12/04 01:57:09  knoaman
    00103  * Scanner re-organization.
    00104  *
    00105  * Revision 1.14  2002/11/04 14:57:03  tng
    00106  * C++ Namespace Support.
    00107  *
    00108  * Revision 1.13  2002/08/14 15:20:38  knoaman
    00109  * [Bug 3111] Problem with LexicalHandler::startDTD() and LexicalHandler::endDTD().
    00110  *
    00111  * Revision 1.12  2002/07/11 18:27:03  knoaman
    00112  * Grammar caching/preparsing - initial implementation.
    00113  *
    00114  * Revision 1.11  2002/06/27 18:48:04  tng
    00115  * API Documentation Update and move getScanner as protected
    00116  *
    00117  * Revision 1.10  2002/06/17 15:41:44  tng
    00118  * Update API Documentation
    00119  *
    00120  * Revision 1.9  2002/06/06 20:38:18  tng
    00121  * Document Fix: document that the returned object from resolveEntity is owned by the parser
    00122  *
    00123  * Revision 1.8  2002/05/31 15:13:53  tng
    00124  * Fix doxygen documentation.
    00125  *
    00126  * Revision 1.7  2002/05/30 16:39:06  knoaman
    00127  * DOM L3 LS.
    00128  *
    00129  * Revision 1.6  2002/05/30 16:20:09  tng
    00130  * Add feature to optionally ignore external DTD.
    00131  *
    00132  * Revision 1.5  2002/05/29 21:37:47  knoaman
    00133  * Add baseURI to resolveEntity to support DOMInputSource.
    00134  *
    00135  * Revision 1.4  2002/05/28 20:44:14  tng
    00136  * [Bug 9104] prefixes dissapearing when schema validation turned on.
    00137  *
    00138  * Revision 1.3  2002/05/27 18:39:21  tng
    00139  * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
    00140  *
    00141  * Revision 1.2  2002/02/20 18:17:01  tng
    00142  * [Bug 5977] Warnings on generating apiDocs.
    00143  *
    00144  * Revision 1.1.1.1  2002/02/01 22:22:07  peiyongz
    00145  * sane_include
    00146  *
    00147  * Revision 1.22  2001/12/05 22:09:02  tng
    00148  * Update documentation for setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation.
    00149  *
    00150  * Revision 1.21  2001/11/20 18:51:44  tng
    00151  * 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).
    00152  *
    00153  * Revision 1.20  2001/08/01 19:11:02  tng
    00154  * Add full schema constraint checking flag to the samples and the parser.
    00155  *
    00156  * Revision 1.19  2001/07/27 20:24:21  tng
    00157  * put getScanner() back as they were there before, not to break existing apps.
    00158  *
    00159  * Revision 1.18  2001/07/16 12:52:09  tng
    00160  * APIDocs fix: default for schema processing in DOMParser, IDOMParser, and SAXParser should be false.
    00161  *
    00162  * Revision 1.17  2001/06/23 14:13:16  tng
    00163  * Remove getScanner from the Parser headers as this is not needed and Scanner is not internal class.
    00164  *
    00165  * Revision 1.16  2001/06/03 19:26:20  jberry
    00166  * Add support for querying error count following parse; enables simple parse without requiring error handler.
    00167  *
    00168  * Revision 1.15  2001/05/11 13:26:22  tng
    00169  * Copyright update.
    00170  *
    00171  * Revision 1.14  2001/05/03 19:09:25  knoaman
    00172  * Support Warning/Error/FatalError messaging.
    00173  * Validity constraints errors are treated as errors, with the ability by user to set
    00174  * validity constraints as fatal errors.
    00175  *
    00176  * Revision 1.13  2001/03/30 16:46:57  tng
    00177  * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
    00178  *
    00179  * Revision 1.12  2001/03/21 21:56:09  tng
    00180  * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
    00181  *
    00182  * Revision 1.11  2001/02/15 15:56:29  tng
    00183  * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
    00184  * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
    00185  * New data field  fSchemaValidation in XMLScanner as the flag.
    00186  *
    00187  * Revision 1.10  2001/01/12 21:23:41  tng
    00188  * Documentation Enhancement: explain values of Val_Scheme
    00189  *
    00190  * Revision 1.9  2000/08/02 18:05:15  jpolast
    00191  * changes required for sax2
    00192  * (changed private members to protected)
    00193  *
    00194  * Revision 1.8  2000/04/12 22:58:30  roddey
    00195  * Added support for 'auto validate' mode.
    00196  *
    00197  * Revision 1.7  2000/03/03 01:29:34  roddey
    00198  * Added a scanReset()/parseReset() method to the scanner and
    00199  * parsers, to allow for reset after early exit from a progressive parse.
    00200  * Added calls to new Terminate() call to all of the samples. Improved
    00201  * documentation in SAX and DOM parsers.
    00202  *
    00203  * Revision 1.6  2000/02/17 03:54:27  rahulj
    00204  * Added some new getters to query the parser state and
    00205  * clarified the documentation.
    00206  *
    00207  * Revision 1.5  2000/02/16 03:42:58  rahulj
    00208  * Finished documenting the SAX Driver implementation.
    00209  *
    00210  * Revision 1.4  2000/02/15 04:47:37  rahulj
    00211  * Documenting the SAXParser framework. Not done yet.
    00212  *
    00213  * Revision 1.3  2000/02/06 07:47:56  rahulj
    00214  * Year 2K copyright swat.
    00215  *
    00216  * Revision 1.2  1999/12/15 19:57:48  roddey
    00217  * Got rid of redundant 'const' on boolean return value. Some compilers choke
    00218  * on this and its useless.
    00219  *
    00220  * Revision 1.1.1.1  1999/11/09 01:07:51  twl
    00221  * Initial checkin
    00222  *
    00223  * Revision 1.6  1999/11/08 20:44:54  rahul
    00224  * Swat for adding in Product name and CVS comment log variable.
    00225  *
    00226  */
    00227
    00228 #if !defined(SAXPARSER_HPP)
    00229 #define SAXPARSER_HPP
    00230
    00231 #include <xercesc/sax/Parser.hpp>
    00232 #include <xercesc/internal/VecAttrListImpl.hpp>
    00233 #include <xercesc/framework/XMLDocumentHandler.hpp>
    00234 #include <xercesc/framework/XMLElementDecl.hpp>
    00235 #include <xercesc/framework/XMLEntityHandler.hpp>
    00236 #include <xercesc/framework/XMLErrorReporter.hpp>
    00237 #include <xercesc/framework/XMLBuffer.hpp>
    00238 #include <xercesc/util/SecurityManager.hpp>
    00239 #include <xercesc/validators/DTD/DocTypeHandler.hpp>
    00240
    00241 XERCES_CPP_NAMESPACE_BEGIN
    00242
    00243
    00244 class DocumentHandler;
    00245 class EntityResolver;
    00246 class XMLPScanToken;
    00247 class XMLScanner;
    00248 class XMLValidator;
    00249 class Grammar;
    00250 class GrammarResolver;
    00251 class XMLGrammarPool;
    00252 class XMLEntityResolver;
    00253 class XMLResourceIdentifier;
    00254 class PSVIHandler;
    00255
    00270 class  SAXParser :
    00271
    00272     public XMemory
    00273     , public Parser
    00274     , public XMLDocumentHandler
    00275     , public XMLErrorReporter
    00276     , public XMLEntityHandler
    00277     , public DocTypeHandler
    00278 {
    00279 public :
    00280     // -----------------------------------------------------------------------
    00281     //  Class types
    00282     // -----------------------------------------------------------------------
    00291     enum ValSchemes
    00292     {
    00293         Val_Never
    00294         , Val_Always
    00295         , Val_Auto
    00296     };
    00297
    00298
    00299     // -----------------------------------------------------------------------
    00300     //  Constructors and Destructor
    00301     // -----------------------------------------------------------------------
    00312     SAXParser
    00313     (
    00314           XMLValidator*   const valToAdopt = 0
    00315         , MemoryManager*  const manager = XMLPlatformUtils::fgMemoryManager
    00316         , XMLGrammarPool* const gramPool = 0
    00317     );
    00318
    00322     ~SAXParser();
    00324
    00325
    00326     // -----------------------------------------------------------------------
    00327     //  Getter Methods
    00328     // -----------------------------------------------------------------------
    00337     DocumentHandler* getDocumentHandler();
    00338
    00345     const DocumentHandler* getDocumentHandler() const;
    00346
    00353     EntityResolver* getEntityResolver();
    00354
    00361     const EntityResolver* getEntityResolver() const;
    00362
    00369     XMLEntityResolver* getXMLEntityResolver();
    00370
    00377     const XMLEntityResolver* getXMLEntityResolver() const;
    00378
    00385     ErrorHandler* getErrorHandler();
    00386
    00393     const ErrorHandler* getErrorHandler() const;
    00394
    00401     PSVIHandler* getPSVIHandler();
    00402
    00409     const PSVIHandler* getPSVIHandler() const;
    00410
    00417     const XMLValidator& getValidator() const;
    00418
    00426     ValSchemes getValidationScheme() const;
    00427
    00438     bool getDoSchema() const;
    00439
    00450     bool getValidationSchemaFullChecking() const;
    00451
    00462     bool getIdentityConstraintChecking() 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
    00672     bool getGenerateSyntheticAnnotations() const;
    00673
    00681     bool getValidateAnnotations() const;
    00682
    00684
    00685
    00686     // -----------------------------------------------------------------------
    00687     //  Setter methods
    00688     // -----------------------------------------------------------------------
    00689
    00702     void setGenerateSyntheticAnnotations(const bool newValue);
    00703
    00711     void setValidateAnnotations(const bool newValue);
    00712
    00726     void setDoNamespaces(const bool newState);
    00727
    00744     void setValidationScheme(const ValSchemes newScheme);
    00745
    00761     void setDoSchema(const bool newState);
    00762
    00779     void setValidationSchemaFullChecking(const bool schemaFullChecking);
    00780
    00792     void setIdentityConstraintChecking(const bool identityConstraintChecking);
    00793
    00809     void setExitOnFirstFatalError(const bool newState);
    00810
    00830     void setValidationConstraintFatal(const bool newState);
    00831
    00852     void setExternalSchemaLocation(const XMLCh* const schemaLocation);
    00853
    00862     void setExternalSchemaLocation(const char* const schemaLocation);
    00863
    00878     void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
    00879
    00888     void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
    00889
    00905     void setSecurityManager(SecurityManager* const securityManager);
    00906
    00923     void setLoadExternalDTD(const bool newState);
    00924
    00942     void cacheGrammarFromParse(const bool newState);
    00943
    00962     void useCachedGrammarInParse(const bool newState);
    00963
    00976     void setCalculateSrcOfs(const bool newState);
    00977
    00988     void setStandardUriConformant(const bool newState);
    00989
    00997     void useScanner(const XMLCh* const scannerName);
    00998
    01009     void setInputBufferSize(const size_t bufferSize);
    01010
    01012
    01013
    01014     // -----------------------------------------------------------------------
    01015     //  Advanced document handler list maintenance methods
    01016     // -----------------------------------------------------------------------
    01017
    01033     void installAdvDocHandler(XMLDocumentHandler* const toInstall);
    01034
    01044     bool removeAdvDocHandler(XMLDocumentHandler* const toRemove);
    01046
    01047
    01048     // -----------------------------------------------------------------------
    01049     //  Progressive scan methods
    01050     // -----------------------------------------------------------------------
    01051
    01054
    01082     bool parseFirst
    01083     (
    01084         const   XMLCh* const    systemId
    01085         ,       XMLPScanToken&  toFill
    01086     );
    01087
    01115     bool parseFirst
    01116     (
    01117         const   char* const     systemId
    01118         ,       XMLPScanToken&  toFill
    01119     );
    01120
    01148     bool parseFirst
    01149     (
    01150         const   InputSource&    source
    01151         ,       XMLPScanToken&  toFill
    01152     );
    01153
    01178     bool parseNext(XMLPScanToken& token);
    01179
    01201     void parseReset(XMLPScanToken& token);
    01202
    01204
    01205     // -----------------------------------------------------------------------
    01206     //  Grammar preparsing interface
    01207     // -----------------------------------------------------------------------
    01208
    01238     Grammar* loadGrammar(const InputSource& source,
    01239                          const short grammarType,
    01240                          const bool toCache = false);
    01241
    01267     Grammar* loadGrammar(const XMLCh* const systemId,
    01268                          const short grammarType,
    01269                          const bool toCache = false);
    01270
    01295     Grammar* loadGrammar(const char* const systemId,
    01296                          const short grammarType,
    01297                          const bool toCache = false);
    01298
    01302     void resetCachedGrammarPool();
    01303
    01305
    01306
    01307     // -----------------------------------------------------------------------
    01308     //  Implementation of the SAX Parser interface
    01309     // -----------------------------------------------------------------------
    01310
    01322     virtual void parse(const InputSource& source);
    01323
    01333     virtual void parse(const XMLCh* const systemId);
    01334
    01342     virtual void parse(const char* const systemId);
    01343
    01354     virtual void setDocumentHandler(DocumentHandler* const handler);
    01355
    01365     virtual void setDTDHandler(DTDHandler* const handler);
    01366
    01377     virtual void setErrorHandler(ErrorHandler* const handler);
    01378
    01389     virtual void setPSVIHandler(PSVIHandler* const handler);
    01390
    01406     virtual void setEntityResolver(EntityResolver* const resolver);
    01407
    01423     virtual void setXMLEntityResolver(XMLEntityResolver* const resolver);
    01424
    01426
    01427
    01428     // -----------------------------------------------------------------------
    01429     //  Implementation of the XMLDocumentHandler interface
    01430     // -----------------------------------------------------------------------
    01431
    01449     virtual void docCharacters
    01450     (
    01451         const   XMLCh* const    chars
    01452         , const unsigned int    length
    01453         , const bool            cdataSection
    01454     );
    01455
    01465     virtual void docComment
    01466     (
    01467         const   XMLCh* const    comment
    01468     );
    01469
    01489     virtual void docPI
    01490     (
    01491         const   XMLCh* const    target
    01492         , const XMLCh* const    data
    01493     );
    01494
    01506     virtual void endDocument();
    01507
    01527     virtual void endElement
    01528     (
    01529         const   XMLElementDecl& elemDecl
    01530         , const unsigned int    urlId
    01531         , const bool            isRoot
    01532         , const XMLCh* const    elemPrefix
    01533     );
    01534
    01545     virtual void endEntityReference
    01546     (
    01547         const   XMLEntityDecl&  entDecl
    01548     );
    01549
    01569     virtual void ignorableWhitespace
    01570     (
    01571         const   XMLCh* const    chars
    01572         , const unsigned int    length
    01573         , const bool            cdataSection
    01574     );
    01575
    01580     virtual void resetDocument();
    01581
    01592     virtual void startDocument();
    01593
    01620     virtual void startElement
    01621     (
    01622         const   XMLElementDecl&         elemDecl
    01623         , const unsigned int            urlId
    01624         , const XMLCh* const            elemPrefix
    01625         , const RefVectorOf<XMLAttr>&   attrList
    01626         , const unsigned int            attrCount
    01627         , const bool                    isEmpty
    01628         , const bool                    isRoot
    01629     );
    01630
    01640     virtual void startEntityReference
    01641     (
    01642         const   XMLEntityDecl&  entDecl
    01643     );
    01644
    01662     virtual void XMLDecl
    01663     (
    01664         const   XMLCh* const    versionStr
    01665         , const XMLCh* const    encodingStr
    01666         , const XMLCh* const    standaloneStr
    01667         , const XMLCh* const    actualEncodingStr
    01668     );
    01670
    01671
    01672     // -----------------------------------------------------------------------
    01673     //  Implementation of the XMLErrorReporter interface
    01674     // -----------------------------------------------------------------------
    01675
    01701     virtual void error
    01702     (
    01703         const   unsigned int                errCode
    01704         , const XMLCh* const                msgDomain
    01705         , const XMLErrorReporter::ErrTypes  errType
    01706         , const XMLCh* const                errorText
    01707         , const XMLCh* const                systemId
    01708         , const XMLCh* const                publicId
    01709         , const XMLSSize_t                  lineNum
    01710         , const XMLSSize_t                  colNum
    01711     );
    01712
    01721     virtual void resetErrors();
    01723
    01724
    01725     // -----------------------------------------------------------------------
    01726     //  Implementation of the XMLEntityHandler interface
    01727     // -----------------------------------------------------------------------
    01728
    01742     virtual void endInputSource(const InputSource& inputSource);
    01743
    01758     virtual bool expandSystemId
    01759     (
    01760         const   XMLCh* const    systemId
    01761         ,       XMLBuffer&      toFill
    01762     );
    01763
    01771     virtual void resetEntities();
    01772
    01795     virtual InputSource* resolveEntity
    01796     (
    01797         const   XMLCh* const    publicId
    01798         , const XMLCh* const    systemId
    01799         , const XMLCh* const    baseURI = 0
    01800     );
    01801
    01818     virtual InputSource* resolveEntity
    01819     (
    01820         XMLResourceIdentifier* resourceIdentifier
    01821     );
    01822
    01834     virtual void startInputSource(const InputSource& inputSource);
    01836
    01837
    01838     // -----------------------------------------------------------------------
    01839     //  Implementation of the Deprecated DocTypeHandler Interface
    01840     // -----------------------------------------------------------------------
    01857     virtual void attDef
    01858     (
    01859         const   DTDElementDecl& elemDecl
    01860         , const DTDAttDef&      attDef
    01861         , const bool            ignore
    01862     );
    01863
    01873     virtual void doctypeComment
    01874     (
    01875         const   XMLCh* const    comment
    01876     );
    01877
    01896     virtual void doctypeDecl
    01897     (
    01898         const   DTDElementDecl& elemDecl
    01899         , const XMLCh* const    publicId
    01900         , const XMLCh* const    systemId
    01901         , const bool            hasIntSubset
    01902         , const bool            hasExtSubset = false
    01903     );
    01904
    01918     virtual void doctypePI
    01919     (
    01920         const   XMLCh* const    target
    01921         , const XMLCh* const    data
    01922     );
    01923
    01935     virtual void doctypeWhitespace
    01936     (
    01937         const   XMLCh* const    chars
    01938         , const unsigned int    length
    01939     );
    01940
    01953     virtual void elementDecl
    01954     (
    01955         const   DTDElementDecl& decl
    01956         , const bool            isIgnored
    01957     );
    01958
    01969     virtual void endAttList
    01970     (
    01971         const   DTDElementDecl& elemDecl
    01972     );
    01973
    01980     virtual void endIntSubset();
    01981
    01988     virtual void endExtSubset();
    01989
    02004     virtual void entityDecl
    02005     (
    02006         const   DTDEntityDecl&  entityDecl
    02007         , const bool            isPEDecl
    02008         , const bool            isIgnored
    02009     );
    02010
    02015     virtual void resetDocType();
    02016
    02029     virtual void notationDecl
    02030     (
    02031         const   XMLNotationDecl&    notDecl
    02032         , const bool                isIgnored
    02033     );
    02034
    02045     virtual void startAttList
    02046     (
    02047         const   DTDElementDecl& elemDecl
    02048     );
    02049
    02056     virtual void startIntSubset();
    02057
    02064     virtual void startExtSubset();
    02065
    02078     virtual void TextDecl
    02079     (
    02080         const   XMLCh* const    versionStr
    02081         , const XMLCh* const    encodingStr
    02082     );
    02084
    02085
    02086     // -----------------------------------------------------------------------
    02087     //  Deprecated Methods
    02088     // -----------------------------------------------------------------------
    02101     bool getDoValidation() const;
    02102
    02116     void setDoValidation(const bool newState);
    02118
    02119
    02120 protected :
    02121     // -----------------------------------------------------------------------
    02122     //  Protected Methods
    02123     // -----------------------------------------------------------------------
    02130     const XMLScanner& getScanner() const;
    02131
    02136     GrammarResolver* getGrammarResolver() const;
    02137
    02138
    02139 private:
    02140     // -----------------------------------------------------------------------
    02141     //  Unimplemented constructors and operators
    02142     // -----------------------------------------------------------------------
    02143     SAXParser(const SAXParser&);
    02144     SAXParser& operator=(const SAXParser&);
    02145
    02146     // -----------------------------------------------------------------------
    02147     //  Initialize/Cleanup methods
    02148     // -----------------------------------------------------------------------
    02149     void initialize();
    02150     void cleanUp();
    02151
    02152     // -----------------------------------------------------------------------
    02153     //  Private data members
    02154     //
    02155     //  fAttrList
    02156     //      A temporary implementation of the basic SAX attribute list
    02157     //      interface. We use this one over and over on each startElement
    02158     //      event to allow SAX-like access to the element attributes.
    02159     //
    02160     //  fDocHandler
    02161     //      The installed SAX doc handler, if any. Null if none.
    02162     //
    02163     //  fDTDHandler
    02164     //      The installed SAX DTD handler, if any. Null if none.
    02165     //
    02166     //  fElemDepth
    02167     //      This is used to track the element nesting depth, so that we can
    02168     //      know when we are inside content. This is so we can ignore char
    02169     //      data outside of content.
    02170     //
    02171     //  fEntityResolver
    02172     //      The installed SAX entity handler, if any. Null if none.
    02173     //
    02174     //  fErrorHandler
    02175     //      The installed SAX error handler, if any. Null if none.
    02176     //
    02177     //  fPSVIHandler
    02178     //      The installed PSVI handler, if any. Null if none.
    02179     //
    02180     //  fAdvDHCount
    02181     //  fAdvDHList
    02182     //  fAdvDHListSize
    02183     //      This is an array of pointers to XMLDocumentHandlers, which is
    02184     //      how we see installed advanced document handlers. There will
    02185     //      usually not be very many at all, so a simple array is used
    02186     //      instead of a collection, for performance. It will grow if needed,
    02187     //      but that is unlikely.
    02188     //
    02189     //      The count is how many handlers are currently installed. The size
    02190     //      is how big the array itself is (for expansion purposes.) When
    02191     //      count == size, is time to expand.
    02192     //
    02193     //  fParseInProgress
    02194     //      This flag is set once a parse starts. It is used to prevent
    02195     //      multiple entrance or reentrance of the parser.
    02196     //
    02197     //  fScanner
    02198     //      The scanner being used by this parser. It is created internally
    02199     //      during construction.
    02200     //
    02201     //   fGrammarPool
    02202     //      The grammar pool passed from external application (through derivatives).
    02203     //      which could be 0, not owned.
    02204     //
    02205     // -----------------------------------------------------------------------
    02206     bool                 fParseInProgress;
    02207     unsigned int         fElemDepth;
    02208     unsigned int         fAdvDHCount;
    02209     unsigned int         fAdvDHListSize;
    02210     VecAttrListImpl      fAttrList;
    02211     DocumentHandler*     fDocHandler;
    02212     DTDHandler*          fDTDHandler;
    02213     EntityResolver*      fEntityResolver;
    02214     XMLEntityResolver*   fXMLEntityResolver;
    02215     ErrorHandler*        fErrorHandler;
    02216     PSVIHandler*         fPSVIHandler;
    02217     XMLDocumentHandler** fAdvDHList;
    02218     XMLScanner*          fScanner;
    02219     GrammarResolver*     fGrammarResolver;
    02220     XMLStringPool*       fURIStringPool;
    02221     XMLValidator*        fValidator;
    02222     MemoryManager*       fMemoryManager;
    02223     XMLGrammarPool*      fGrammarPool;
    02224     XMLBuffer            fElemQNameBuf;
    02225 };
    02226
    02227
    02228 // ---------------------------------------------------------------------------
    02229 //  SAXParser: Getter methods
    02230 // ---------------------------------------------------------------------------
    02231 inline DocumentHandler* SAXParser::getDocumentHandler()
    02232 {
    02233     return fDocHandler;
    02234 }
    02235
    02236 inline const DocumentHandler* SAXParser::getDocumentHandler() const
    02237 {
    02238     return fDocHandler;
    02239 }
    02240
    02241 inline EntityResolver* SAXParser::getEntityResolver()
    02242 {
    02243     return fEntityResolver;
    02244 }
    02245
    02246 inline XMLEntityResolver* SAXParser::getXMLEntityResolver()
    02247 {
    02248     return fXMLEntityResolver;
    02249 }
    02250
    02251 inline const XMLEntityResolver* SAXParser::getXMLEntityResolver() const
    02252 {
    02253     return fXMLEntityResolver;
    02254 }
    02255
    02256 inline const EntityResolver* SAXParser::getEntityResolver() const
    02257 {
    02258     return fEntityResolver;
    02259 }
    02260
    02261 inline ErrorHandler* SAXParser::getErrorHandler()
    02262 {
    02263     return fErrorHandler;
    02264 }
    02265
    02266 inline const ErrorHandler* SAXParser::getErrorHandler() const
    02267 {
    02268     return fErrorHandler;
    02269 }
    02270
    02271 inline PSVIHandler* SAXParser::getPSVIHandler()
    02272 {
    02273     return fPSVIHandler;
    02274 }
    02275
    02276 inline const PSVIHandler* SAXParser::getPSVIHandler() const
    02277 {
    02278     return fPSVIHandler;
    02279 }
    02280
    02281 inline const XMLScanner& SAXParser::getScanner() const
    02282 {
    02283     return *fScanner;
    02284 }
    02285
    02286 inline GrammarResolver* SAXParser::getGrammarResolver() const
    02287 {
    02288     return fGrammarResolver;
    02289 }
    02290
    02291 XERCES_CPP_NAMESPACE_END
    02292
    02293 #endif

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