Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:57

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_SAXPARSER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_SAXPARSER_HPP
0024 
0025 #include <xercesc/sax/Parser.hpp>
0026 #include <xercesc/internal/VecAttrListImpl.hpp>
0027 #include <xercesc/framework/XMLDocumentHandler.hpp>
0028 #include <xercesc/framework/XMLElementDecl.hpp>
0029 #include <xercesc/framework/XMLEntityHandler.hpp>
0030 #include <xercesc/framework/XMLErrorReporter.hpp>
0031 #include <xercesc/framework/XMLBuffer.hpp>
0032 #include <xercesc/util/SecurityManager.hpp>
0033 #include <xercesc/validators/common/Grammar.hpp>
0034 #include <xercesc/validators/DTD/DocTypeHandler.hpp>
0035 
0036 
0037 XERCES_CPP_NAMESPACE_BEGIN
0038 
0039 
0040 class DocumentHandler;
0041 class EntityResolver;
0042 class XMLPScanToken;
0043 class XMLScanner;
0044 class XMLValidator;
0045 class GrammarResolver;
0046 class XMLGrammarPool;
0047 class XMLEntityResolver;
0048 class XMLResourceIdentifier;
0049 class PSVIHandler;
0050 
0051 /**
0052   * This class implements the SAX 'Parser' interface and should be
0053   * used by applications wishing to parse the XML files using SAX.
0054   * It allows the client program to install SAX handlers for event
0055   * callbacks.
0056   *
0057   * <p>It can be used to instantiate a validating or non-validating
0058   * parser, by setting a member flag.</p>
0059   *
0060   * @deprecated This interface has been replaced by the SAX2
0061   *             interface, which includes Namespace support.
0062   *             See SAX2XMLReader for more information.
0063   *
0064   * Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing.
0065   *
0066   *
0067   */
0068 
0069 class PARSERS_EXPORT SAXParser :
0070 
0071     public XMemory
0072     , public Parser
0073     , public XMLDocumentHandler
0074     , public XMLErrorReporter
0075     , public XMLEntityHandler
0076     , public DocTypeHandler
0077 {
0078 public :
0079     // -----------------------------------------------------------------------
0080     //  Class types
0081     // -----------------------------------------------------------------------
0082     /** ValScheme enum used in setValidationScheme
0083       *    Val_Never:  Do not report validation errors.
0084       *    Val_Always: The parser will always report validation errors.
0085       *    Val_Auto:   The parser will report validation errors only if a grammar is specified.
0086       *
0087       * @see #setValidationScheme
0088       */
0089 
0090     enum ValSchemes
0091     {
0092         Val_Never
0093         , Val_Always
0094         , Val_Auto
0095     };
0096 
0097 
0098     // -----------------------------------------------------------------------
0099     //  Constructors and Destructor
0100     // -----------------------------------------------------------------------
0101     /** @name Constructors and Destructor */
0102     //@{
0103     /** Constructor with an instance of validator class to use for
0104       * validation.
0105       * @param valToAdopt Pointer to the validator instance to use. The
0106       *                   parser is responsible for freeing the memory.
0107       * @param manager    Pointer to the memory manager to be used to
0108       *                   allocate objects.
0109       * @param gramPool   The collection of cached grammars.
0110       */
0111     SAXParser
0112     (
0113           XMLValidator*   const valToAdopt = 0
0114         , MemoryManager*  const manager = XMLPlatformUtils::fgMemoryManager
0115         , XMLGrammarPool* const gramPool = 0
0116     );
0117 
0118     /**
0119       * Destructor
0120       */
0121     ~SAXParser();
0122     //@}
0123 
0124 
0125     // -----------------------------------------------------------------------
0126     //  Getter Methods
0127     // -----------------------------------------------------------------------
0128     /** @name Getter methods */
0129     //@{
0130     /**
0131       * This method returns the installed document handler. Suitable
0132       * for 'lvalue' usages.
0133       *
0134       * @return The pointer to the installed document handler object.
0135       */
0136     DocumentHandler* getDocumentHandler();
0137 
0138     /**
0139       * This method returns the installed document handler. Suitable
0140       * only for 'rvalue' usages.
0141       *
0142       * @return A const pointer to the installed document handler object.
0143       */
0144     const DocumentHandler* getDocumentHandler() const;
0145 
0146     /**
0147       * This method returns the installed entity resolver. Suitable
0148       * for 'lvalue' usages.
0149       *
0150       * @return The pointer to the installed entity resolver object.
0151       */
0152     EntityResolver* getEntityResolver();
0153 
0154     /**
0155       * This method returns the installed entity resolver. Suitable
0156       * for 'rvalue' usages.
0157       *
0158       * @return A const pointer to the installed entity resolver object.
0159       */
0160     const EntityResolver* getEntityResolver() const;
0161 
0162     /**
0163       * This method returns the installed entity resolver. Suitable
0164       * for 'lvalue' usages.
0165       *
0166       * @return The pointer to the installed entity resolver object.
0167       */
0168     XMLEntityResolver* getXMLEntityResolver();
0169 
0170     /**
0171       * This method returns the installed entity resolver. Suitable
0172       * for 'rvalue' usages.
0173       *
0174       * @return A const pointer to the installed entity resolver object.
0175       */
0176     const XMLEntityResolver* getXMLEntityResolver() const;
0177 
0178     /**
0179       * This method returns the installed error handler. Suitable
0180       * for 'lvalue' usages.
0181       *
0182       * @return The pointer to the installed error handler object.
0183       */
0184     ErrorHandler* getErrorHandler();
0185 
0186     /**
0187       * This method returns the installed error handler. Suitable
0188       * for 'rvalue' usages.
0189       *
0190       * @return A const pointer to the installed error handler object.
0191       */
0192     const ErrorHandler* getErrorHandler() const;
0193 
0194     /**
0195       * This method returns the installed PSVI handler. Suitable
0196       * for 'lvalue' usages.
0197       *
0198       * @return The pointer to the installed PSVI handler object.
0199       */
0200     PSVIHandler* getPSVIHandler();
0201 
0202     /**
0203       * This method returns the installed PSVI handler. Suitable
0204       * for 'rvalue' usages.
0205       *
0206       * @return A const pointer to the installed PSVI handler object.
0207       */
0208     const PSVIHandler* getPSVIHandler() const;
0209 
0210     /**
0211       * This method returns a reference to the parser's installed
0212       * validator.
0213       *
0214       * @return A const reference to the installed validator object.
0215       */
0216     const XMLValidator& getValidator() const;
0217 
0218     /**
0219       * This method returns an enumerated value that indicates the current
0220       * validation scheme set on this parser.
0221       *
0222       * @return The ValSchemes value current set on this parser.
0223       * @see #setValidationScheme
0224       */
0225     ValSchemes getValidationScheme() const;
0226 
0227     /** Get the 'do schema' flag
0228       *
0229       * This method returns the state of the parser's schema processing
0230       * flag.
0231       *
0232       * @return true, if the parser is currently configured to
0233       *         understand schema, false otherwise.
0234       *
0235       * @see #setDoSchema
0236       */
0237     bool getDoSchema() const;
0238 
0239     /** Get the 'full schema constraint checking' flag
0240       *
0241       * This method returns the state of the parser's full schema constraint
0242       * checking flag.
0243       *
0244       * @return true, if the parser is currently configured to
0245       *         have full schema constraint checking, false otherwise.
0246       *
0247       * @see #setValidationSchemaFullChecking
0248       */
0249     bool getValidationSchemaFullChecking() const;
0250 
0251     /** Get the 'identity constraint checking' flag
0252       *
0253       * This method returns the state of the parser's identity constraint
0254       * checking flag.
0255       *
0256       * @return true, if the parser is currently configured to
0257       *         have identity constraint checking, false otherwise.
0258       *
0259       * @see #setIdentityConstraintChecking
0260       */
0261     bool getIdentityConstraintChecking() const;
0262 
0263     /** Get error count from the last parse operation.
0264       *
0265       * This method returns the error count from the last parse
0266       * operation. Note that this count is actually stored in the
0267       * scanner, so this method simply returns what the
0268       * scanner reports.
0269       *
0270       * @return number of errors encountered during the latest
0271       *         parse operation.
0272       */
0273     int getErrorCount() const;
0274 
0275     /**
0276       * This method returns the state of the parser's namespace
0277       * handling capability.
0278       *
0279       * @return true, if the parser is currently configured to
0280       *         understand namespaces, false otherwise.
0281       *
0282       * @see #setDoNamespaces
0283       */
0284     bool getDoNamespaces() const;
0285 
0286     /**
0287       * This method returns the state of the parser's
0288       * exit-on-First-Fatal-Error flag.
0289       *
0290       * @return true, if the parser is currently configured to
0291       *         exit on the first fatal error, false otherwise.
0292       *
0293       * @see #setExitOnFirstFatalError
0294       */
0295     bool getExitOnFirstFatalError() const;
0296 
0297     /**
0298       * This method returns the state of the parser's
0299       * validation-constraint-fatal flag.
0300       *
0301       * @return true, if the parser is currently configured to
0302       *         set validation constraint errors as fatal, false
0303       *         otherwise.
0304       *
0305       * @see #setValidationConstraintFatal
0306       */
0307     bool getValidationConstraintFatal() const;
0308 
0309    /** Get the set of Namespace/SchemaLocation that is specified externally.
0310       *
0311       * This method returns the list of Namespace/SchemaLocation that was
0312       * specified using setExternalSchemaLocation.
0313       *
0314       * The parser owns the returned string, and the memory allocated for
0315       * the returned string will be destroyed when the parser is deleted.
0316       *
0317       * To ensure accessibility of the returned information after the parser
0318       * is deleted, callers need to copy and store the returned information
0319       * somewhere else.
0320       *
0321       * @return a pointer to the list of Namespace/SchemaLocation that was
0322       *         specified externally.  The pointer spans the same life-time as
0323       *         the parser.  A null pointer is returned if nothing
0324       *         was specified externally.
0325       *
0326       * @see #setExternalSchemaLocation(const XMLCh* const)
0327       */
0328     XMLCh* getExternalSchemaLocation() const;
0329 
0330    /** Get the noNamespace SchemaLocation that is specified externally.
0331       *
0332       * This method returns the no target namespace XML Schema Location
0333       * that was specified using setExternalNoNamespaceSchemaLocation.
0334       *
0335       * The parser owns the returned string, and the memory allocated for
0336       * the returned string will be destroyed when the parser is deleted.
0337       *
0338       * To ensure accessibility of the returned information after the parser
0339       * is deleted, callers need to copy and store the returned information
0340       * somewhere else.
0341       *
0342       * @return a pointer to the no target namespace Schema Location that was
0343       *         specified externally.  The pointer spans the same life-time as
0344       *         the parser.  A null pointer is returned if nothing
0345       *         was specified externally.
0346       *
0347       * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const)
0348       */
0349     XMLCh* getExternalNoNamespaceSchemaLocation() const;
0350 
0351    /** Get the SecurityManager instance attached to this parser.
0352       *
0353       * This method returns the security manager
0354       * that was specified using setSecurityManager.
0355       *
0356       * The SecurityManager instance must have been specified by the application;
0357       * this should not be deleted until after the parser has been deleted (or
0358       * a new SecurityManager instance has been supplied to the parser).
0359       *
0360       * @return a pointer to the SecurityManager instance
0361       *         specified externally.  A null pointer is returned if nothing
0362       *         was specified externally.
0363       *
0364       * @see #setSecurityManager(SecurityManager* const)
0365       */
0366     SecurityManager* getSecurityManager() const;
0367 
0368     /** Get the raw buffer low water mark for this parser.
0369       *
0370       * If the number of available bytes in the raw buffer is less than
0371       * the low water mark the parser will attempt to read more data before
0372       * continuing parsing. By default the value for this parameter is 100
0373       * bytes. You may want to set this parameter to 0 if you would like
0374       * the parser to parse the available data immediately without
0375       * potentially blocking while waiting for more date.
0376       *
0377       * @return current low water mark
0378       *
0379       * @see #setSecurityManager
0380       */
0381     XMLSize_t getLowWaterMark() const;
0382 
0383     /** Get the 'Disallow DOCTYPE (DTD)' flag
0384       *
0385       * This method returns the state of the parser's disallowed DOCTYPE
0386       * flag.
0387       *
0388       * @return false, if the parser is currently configured to
0389       *         allow DOCTYPE, true otherwise.
0390       *
0391       * @see #setDisallowDoctype()
0392       * @see #getLoadExternalDTD
0393       * @see #getValidationScheme
0394       */
0395     bool getDisallowDoctype() const;
0396 
0397     /** Get the 'Loading External DTD' flag
0398       *
0399       * This method returns the state of the parser's loading external DTD
0400       * flag.
0401       *
0402       * @return false, if the parser is currently configured to
0403       *         ignore external DTD completely, true otherwise.
0404       *
0405       * @see #setLoadExternalDTD
0406       * @see #getDisallowDoctype
0407       * @see #getValidationScheme
0408       */
0409     bool getLoadExternalDTD() const;
0410 
0411     /** Get the 'Loading Schema' flag
0412       *
0413       * This method returns the state of the parser's loading schema
0414       * flag.
0415       *
0416       * @return true, if the parser is currently configured to
0417       *         automatically load schemas that are not in the
0418       *         grammar pool, false otherwise.
0419       *
0420       * @see #setLoadSchema
0421       */
0422     bool getLoadSchema() const;
0423 
0424     /** Get the 'Grammar caching' flag
0425       *
0426       * This method returns the state of the parser's grammar caching when
0427       * parsing an XML document.
0428       *
0429       * @return true, if the parser is currently configured to
0430       *         cache grammars, false otherwise.
0431       *
0432       * @see #cacheGrammarFromParse
0433       */
0434     bool isCachingGrammarFromParse() const;
0435 
0436     /** Get the 'Use cached grammar' flag
0437       *
0438       * This method returns the state of the parser's use of cached grammar
0439       * when parsing an XML document.
0440       *
0441       * @return true, if the parser is currently configured to
0442       *         use cached grammars, false otherwise.
0443       *
0444       * @see #useCachedGrammarInParse
0445       */
0446     bool isUsingCachedGrammarInParse() const;
0447 
0448     /**
0449       * Get the 'calculate src offset flag'
0450       *
0451       * This method returns the state of the parser's src offset calculation
0452       * when parsing an XML document.
0453       *
0454       * @return true, if the parser is currently configured to
0455       *         calculate src offsets, false otherwise.
0456       *
0457       * @see #setCalculateSrcOfs
0458       */
0459     bool getCalculateSrcOfs() const;
0460 
0461     /**
0462       * Get the 'force standard uri flag'
0463       *
0464       * This method returns the state if the parser forces standard uri
0465       *
0466       * @return true, if the parser is currently configured to
0467       *         force standard uri, i.e. malformed uri will be rejected.
0468       *
0469       * @see #setStandardUriConformant
0470       */
0471     bool getStandardUriConformant() const;
0472 
0473     /**
0474      * Retrieve the grammar that is associated with the specified namespace key
0475      *
0476      * @param  nameSpaceKey Namespace key
0477      * @return Grammar associated with the Namespace key.
0478      */
0479     Grammar* getGrammar(const XMLCh* const nameSpaceKey);
0480 
0481     /**
0482      * Retrieve the grammar where the root element is declared.
0483      *
0484      * @return Grammar where root element declared
0485      */
0486     Grammar* getRootGrammar();
0487 
0488     /**
0489      * Returns the string corresponding to a URI id from the URI string pool.
0490      *
0491      * @param uriId id of the string in the URI string pool.
0492      * @return URI string corresponding to the URI id.
0493      */
0494     const XMLCh* getURIText(unsigned int uriId) const;
0495 
0496     /**
0497      * Returns the current src offset within the input source.
0498      * To be used only while parsing is in progress.
0499      *
0500      * @return offset within the input source
0501      */
0502     XMLFilePos getSrcOffset() const;
0503 
0504     /** Get the 'generate synthetic annotations' flag
0505       *
0506       * @return true, if the parser is currently configured to
0507       *         generate synthetic annotations, false otherwise.
0508       *         A synthetic XSAnnotation is created when a schema
0509       *         component has non-schema attributes but has no
0510       *         child annotations so that the non-schema attributes
0511       *         can be recovered under PSVI.
0512       *
0513       * @see #setGenerateSyntheticAnnotations
0514       */
0515     bool getGenerateSyntheticAnnotations() const;
0516 
0517     /** Get the 'validate annotations' flag
0518       *
0519       * @return true, if the parser is currently configured to
0520       *         validate annotations, false otherwise.
0521       *
0522       * @see #setValidateAnnotations
0523       */
0524     bool getValidateAnnotations() const;
0525 
0526     /** Get the 'ignore cached DTD grammar' flag
0527       *
0528       * @return true, if the parser is currently configured to
0529       *         ignore cached DTD, false otherwise.
0530       *
0531       * @see #setIgnoreCachedDTD
0532       */
0533     bool getIgnoreCachedDTD() const;
0534 
0535     /** Get the 'ignore annotations' flag
0536       *
0537       * @return true, if the parser is currently configured to
0538       *         ignore annotations, false otherwise.
0539       *
0540       * @see #setIgnoreAnnotations
0541       */
0542     bool getIgnoreAnnotations() const;
0543 
0544     /** Get the 'disable default entity resolution' flag
0545       *
0546       * @return true, if the parser is currently configured to
0547       *         not perform default entity resolution, false otherwise.
0548       *
0549       * @see #setDisableDefaultEntityResolution
0550       */
0551     bool getDisableDefaultEntityResolution() const;
0552 
0553     /** Get the 'skip DTD validation' flag
0554       *
0555       * @return true, if the parser is currently configured to
0556       *         skip DTD validation, false otherwise.
0557       *
0558       * @see #setSkipDTDValidation
0559       */
0560     bool getSkipDTDValidation() const;
0561 
0562     /** Get the 'handle multiple schema imports' flag
0563       *
0564       * @return true, if the parser is currently configured to
0565       *         import multiple schemas with the same namespace, false otherwise.
0566       *
0567       * @see #setHandleMultipleImports
0568       */
0569     bool getHandleMultipleImports() const;
0570     //@}
0571 
0572 
0573     // -----------------------------------------------------------------------
0574     //  Setter methods
0575     // -----------------------------------------------------------------------
0576 
0577     /** @name Setter methods */
0578     //@{
0579     /** set the 'generate synthetic annotations' flag
0580       *
0581       * @param newValue The value for specifying whether Synthetic Annotations
0582       *        should be generated or not.
0583       *        A synthetic XSAnnotation is created when a schema
0584       *        component has non-schema attributes but has no
0585       *        child annotations.
0586       *
0587       * @see #getGenerateSyntheticAnnotations
0588       */
0589     void setGenerateSyntheticAnnotations(const bool newValue);
0590 
0591     /** set the 'validate annotations' flag
0592       *
0593       * @param newValue The value for specifying whether annotations
0594       *        should be validate or not.
0595       *
0596       * @see #getValidateAnnotations
0597       */
0598     void setValidateAnnotations(const bool newValue);
0599 
0600     /**
0601       * This method allows users to enable or disable the parser's
0602       * namespace processing. When set to true, parser starts enforcing
0603       * all the constraints / rules specified by the NameSpace
0604       * specification.
0605       *
0606       * <p>The parser's default state is: false.</p>
0607       *
0608       * @param newState The value specifying whether NameSpace rules should
0609       *                 be enforced or not.
0610       *
0611       * @see #getDoNamespaces
0612       */
0613     void setDoNamespaces(const bool newState);
0614 
0615     /**
0616       * This method allows users to set the validation scheme to be used
0617       * by this parser. The value is one of the ValSchemes enumerated values
0618       * defined by this class:
0619       *
0620       * <br>  Val_Never  - turn off validation
0621       * <br>  Val_Always - turn on validation
0622       * <br>  Val_Auto   - turn on validation if any internal/external
0623       *                  DTD subset have been seen
0624       *
0625       * <p>The parser's default state is: Val_Never.</p>
0626       *
0627       * @param newScheme The new validation scheme to use.
0628       *
0629       * @see #getValidationScheme
0630       */
0631     void setValidationScheme(const ValSchemes newScheme);
0632 
0633     /** Set the 'schema support' flag
0634       *
0635       * This method allows users to enable or disable the parser's
0636       * schema processing. When set to false, parser will not process
0637       * any schema found.
0638       *
0639       * The parser's default state is: false.
0640       *
0641       * Note: If set to true, namespace processing must also be turned on.
0642       *
0643       * @param newState The value specifying whether schema support should
0644       *                 be enforced or not.
0645       *
0646       * @see #getDoSchema
0647       */
0648     void setDoSchema(const bool newState);
0649 
0650     /**
0651       * This method allows the user to turn full Schema constraint checking on/off.
0652       * Only takes effect if Schema validation is enabled.
0653       * If turned off, partial constraint checking is done.
0654       *
0655       * Full schema constraint checking includes those checking that may
0656       * be time-consuming or memory intensive. Currently, particle unique
0657       * attribution constraint checking and particle derivation restriction checking
0658       * are controlled by this option.
0659       *
0660       * The parser's default state is: false.
0661       *
0662       * @param schemaFullChecking True to turn on full schema constraint checking.
0663       *
0664       * @see #getValidationSchemaFullChecking
0665       */
0666     void setValidationSchemaFullChecking(const bool schemaFullChecking);
0667 
0668     /**
0669       * This method allows the user to turn identity constraint checking on/off.
0670       * Only takes effect if Schema validation is enabled.
0671       * If turned off, identity constraint checking is not done.
0672       *
0673       * The parser's default state is: true.
0674       *
0675       * @param identityConstraintChecking True to turn on identity constraint checking.
0676       *
0677       * @see #getIdentityConstraintChecking
0678       */
0679     void setIdentityConstraintChecking(const bool identityConstraintChecking);
0680 
0681     /**
0682       * This method allows users to set the parser's behaviour when it
0683       * encounters the first fatal error. If set to true, the parser
0684       * will exit at the first fatal error. If false, then it will
0685       * report the error and continue processing.
0686       *
0687       * <p>The default value is 'true' and the parser exits on the
0688       * first fatal error.</p>
0689       *
0690       * @param newState The value specifying whether the parser should
0691       *                 continue or exit when it encounters the first
0692       *                 fatal error.
0693       *
0694       * @see #getExitOnFirstFatalError
0695       */
0696     void setExitOnFirstFatalError(const bool newState);
0697 
0698     /**
0699       * This method allows users to set the parser's behaviour when it
0700       * encounters a validation constraint error. If set to true, and the
0701       * the parser will treat validation error as fatal and will exit depends on the
0702       * state of "getExitOnFirstFatalError". If false, then it will
0703       * report the error and continue processing.
0704       *
0705       * Note: setting this true does not mean the validation error will be printed with
0706       * the word "Fatal Error".   It is still printed as "Error", but the parser
0707       * will exit if "setExitOnFirstFatalError" is set to true.
0708       *
0709       * <p>The default value is 'false'.</p>
0710       *
0711       * @param newState If true, the parser will exit if "setExitOnFirstFatalError"
0712       *                 is set to true.
0713       *
0714       * @see #getValidationConstraintFatal
0715       * @see #setExitOnFirstFatalError
0716       */
0717     void setValidationConstraintFatal(const bool newState);
0718 
0719     /**
0720       * This method allows the user to specify a list of schemas to use.
0721       * If the targetNamespace of a schema specified using this method matches
0722       * the targetNamespace of a schema occurring in the instance document in
0723       * the schemaLocation attribute, or if the targetNamespace matches the
0724       * namespace attribute of the "import" element, the schema specified by the
0725       * user using this method will be used (i.e., the schemaLocation attribute
0726       * in the instance document or on the "import" element will be effectively ignored).
0727       *
0728       * If this method is called more than once, only the last one takes effect.
0729       *
0730       * The syntax is the same as for schemaLocation attributes in instance
0731       * documents: e.g, "http://www.example.com file_name.xsd". The user can
0732       * specify more than one XML Schema in the list.
0733       *
0734       * @param schemaLocation the list of schemas to use
0735       *
0736       * @see #getExternalSchemaLocation
0737       */
0738 
0739     void setExternalSchemaLocation(const XMLCh* const schemaLocation);
0740 
0741     /**
0742       * This method is same as setExternalSchemaLocation(const XMLCh* const).
0743       * It takes native char string as parameter
0744       *
0745       * @param schemaLocation the list of schemas to use
0746       *
0747       * @see #setExternalSchemaLocation(const XMLCh* const)
0748       */
0749     void setExternalSchemaLocation(const char* const schemaLocation);
0750 
0751     /**
0752       * This method allows the user to specify the no target namespace XML
0753       * Schema Location externally.  If specified, the instance document's
0754       * noNamespaceSchemaLocation attribute will be effectively ignored.
0755       *
0756       * If this method is called more than once, only the last one takes effect.
0757       *
0758       * The syntax is the same as for the noNamespaceSchemaLocation attribute
0759       * that may occur in an instance document: e.g."file_name.xsd".
0760       *
0761       * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace
0762       *
0763       * @see #getExternalNoNamespaceSchemaLocation
0764       */
0765     void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
0766 
0767     /**
0768       * This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const).
0769       * It takes native char string as parameter
0770       *
0771       * @param noNamespaceSchemaLocation the XML Schema Location with no target namespace
0772       *
0773       * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const)
0774       */
0775     void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
0776 
0777     /**
0778       * This allows an application to set a SecurityManager on
0779       * the parser; this object stores information that various
0780       * components use to limit their consumption of system
0781       * resources while processing documents.
0782       *
0783       * If this method is called more than once, only the last one takes effect.
0784       * It may not be reset during a parse.
0785       *
0786       *
0787       * @param securityManager  the SecurityManager instance to
0788       * be used by this parser
0789       *
0790       * @see #getSecurityManager
0791       */
0792     void setSecurityManager(SecurityManager* const securityManager);
0793 
0794     /** Set the raw buffer low water mark for this parser.
0795       *
0796       * If the number of available bytes in the raw buffer is less than
0797       * the low water mark the parser will attempt to read more data before
0798       * continuing parsing. By default the value for this parameter is 100
0799       * bytes. You may want to set this parameter to 0 if you would like
0800       * the parser to parse the available data immediately without
0801       * potentially blocking while waiting for more date.
0802       *
0803       * @param lwm new low water mark
0804       *
0805       * @see #getSecurityManager
0806       */
0807     void setLowWaterMark(XMLSize_t lwm);
0808 
0809     /** Set the 'Disallow DOCTYPE (DTD)' flag
0810       *
0811       * This method allows users to disable the processing of DOCTYPE (DTD).
0812       * When set to true, the parser will throw an exception if the document
0813       * contains the DOCTYPE node.
0814       *
0815       * The parser's default state is: false.
0816       *
0817       * @param newState The value specifying whether to disallow DOCTYPE
0818       *                 or not.
0819       *
0820       * @see #setDisallowDoctype()
0821       * @see #getLoadExternalDTD
0822       * @see #getValidationScheme
0823       */
0824     void setDisallowDoctype(const bool newState);
0825 
0826     /** Set the 'Loading External DTD' flag
0827       *
0828       * This method allows users to enable or disable the loading of external DTD.
0829       * When set to false, the parser will ignore any external DTD completely
0830       * if the validationScheme is set to Val_Never.
0831       *
0832       * The parser's default state is: true.
0833       *
0834       * This flag is ignored if the validationScheme is set to Val_Always or Val_Auto.
0835       *
0836       * @param newState The value specifying whether external DTD should
0837       *                 be loaded or not.
0838       *
0839       * @see #getLoadExternalDTD
0840       * @see #setDisallowDoctype
0841       * @see #setValidationScheme
0842       */
0843     void setLoadExternalDTD(const bool newState);
0844 
0845     /** Set the 'Loading Schema' flag
0846       *
0847       * This method allows users to enable or disable the loading of schemas.
0848       * When set to false, the parser not attempt to load schemas beyond
0849       * querying the grammar pool for them.
0850       *
0851       * The parser's default state is: true.
0852       *
0853       * @param newState The value specifying whether schemas should
0854       *                 be loaded if they're not found in the grammar
0855       *                 pool.
0856       *
0857       * @see #getLoadSchema
0858       * @see #setDoSchema
0859       */
0860     void setLoadSchema(const bool newState);
0861 
0862     /** Set the 'Grammar caching' flag
0863       *
0864       * This method allows users to enable or disable caching of grammar when
0865       * parsing XML documents. When set to true, the parser will cache the
0866       * resulting grammar for use in subsequent parses.
0867       *
0868       * If the flag is set to true, the 'Use cached grammar' flag will also be
0869       * set to true.
0870       *
0871       * The parser's default state is: false.
0872       *
0873       * @param newState The value specifying whether we should cache grammars
0874       *                 or not.
0875       *
0876       * @see #isCachingGrammarFromParse
0877       * @see #useCachedGrammarInParse
0878       */
0879     void cacheGrammarFromParse(const bool newState);
0880 
0881     /** Set the 'Use cached grammar' flag
0882       *
0883       * This method allows users to enable or disable the use of cached
0884       * grammars.  When set to true, the parser will use the cached grammar,
0885       * instead of building the grammar from scratch, to validate XML
0886       * documents.
0887       *
0888       * If the 'Grammar caching' flag is set to true, this method ignores the
0889       * value passed in.
0890       *
0891       * The parser's default state is: false.
0892       *
0893       * @param newState The value specifying whether we should use the cached
0894       *                 grammar or not.
0895       *
0896       * @see #isUsingCachedGrammarInParse
0897       * @see #cacheGrammarFromParse
0898       */
0899     void useCachedGrammarInParse(const bool newState);
0900 
0901     /** Enable/disable src offset calculation
0902       *
0903       * This method allows users to enable/disable src offset calculation.
0904       * Disabling the calculation will improve performance.
0905       *
0906       * The parser's default state is: false.
0907       *
0908       * @param newState The value specifying whether we should enable or
0909       *                 disable src offset calculation
0910       *
0911       * @see #getCalculateSrcOfs
0912       */
0913     void setCalculateSrcOfs(const bool newState);
0914 
0915     /** Force standard uri
0916       *
0917       * This method allows users to tell the parser to force standard uri conformance.
0918       *
0919       * The parser's default state is: false.
0920       *
0921       * @param newState The value specifying whether the parser should reject malformed URI.
0922       *
0923       * @see #getStandardUriConformant
0924       */
0925     void setStandardUriConformant(const bool newState);
0926 
0927     /** Set the scanner to use when scanning the XML document
0928       *
0929       * This method allows users to set the scanner to use
0930       * when scanning a given XML document.
0931       *
0932       * @param scannerName The name of the desired scanner
0933       */
0934     void useScanner(const XMLCh* const scannerName);
0935 
0936     /** Set maximum input buffer size
0937       *
0938       * This method allows users to limit the size of buffers used in parsing
0939       * XML character data. The effect of setting this size is to limit the
0940       * size of a ContentHandler::characters() call.
0941       *
0942       * The parser's default input buffer size is 1 megabyte.
0943       *
0944       * @param bufferSize The maximum input buffer size
0945       */
0946     void setInputBufferSize(const XMLSize_t bufferSize);
0947 
0948     /** Set the 'ignore cached DTD grammar' flag
0949       *
0950       * This method gives users the option to ignore a cached DTD grammar, when
0951       * an XML document contains both an internal and external DTD, and the use
0952       * cached grammar from parse option is enabled. Currently, we do not allow
0953       * using cached DTD grammar when an internal subset is present in the
0954       * document. This option will only affect the behavior of the parser when
0955       * an internal and external DTD both exist in a document (i.e. no effect
0956       * if document has no internal subset).
0957       *
0958       * The parser's default state is false
0959       *
0960       * @param newValue The state to set
0961       */
0962     void setIgnoreCachedDTD(const bool newValue);
0963 
0964     /** Set the 'ignore annotation' flag
0965       *
0966       * This method gives users the option to not generate XSAnnotations
0967       * when "traversing" a schema.
0968       *
0969       * The parser's default state is false
0970       *
0971       * @param newValue The state to set
0972       */
0973     void setIgnoreAnnotations(const bool newValue);
0974 
0975     /** Set the 'disable default entity resolution' flag
0976       *
0977       * This method gives users the option to not perform default entity
0978       * resolution.  If the user's resolveEntity method returns NULL the
0979       * parser will try to resolve the entity on its own.  When this option
0980       * is set to true, the parser will not attempt to resolve the entity
0981       * when the resolveEntity method returns NULL.
0982       *
0983       * The parser's default state is false
0984       *
0985       * @param newValue The state to set
0986       *
0987       * @see #EntityResolver
0988       */
0989     void setDisableDefaultEntityResolution(const bool newValue);
0990 
0991     /** Set the 'skip DTD validation' flag
0992       *
0993       * This method gives users the option to skip DTD validation only when
0994       * schema validation is on (i.e. when performing validation,  we will
0995       * ignore the DTD, except for entities, when schema validation is enabled).
0996       *
0997       * NOTE: This option is ignored if schema validation is disabled.
0998       *
0999       * The parser's default state is false
1000       *
1001       * @param newValue The state to set
1002       */
1003     void setSkipDTDValidation(const bool newValue);
1004 
1005     /** Set the 'handle multiple schema imports' flag
1006       *
1007       * This method gives users the ability to import multiple schemas that
1008       * have the same namespace.
1009       *
1010       * NOTE: This option is ignored if schema validation is disabled.
1011       *
1012       * The parser's default state is false
1013       *
1014       * @param newValue The state to set
1015       */
1016     void setHandleMultipleImports(const bool newValue);
1017     //@}
1018 
1019 
1020     // -----------------------------------------------------------------------
1021     //  Advanced document handler list maintenance methods
1022     // -----------------------------------------------------------------------
1023 
1024     /** @name Advanced document handler list maintenance methods */
1025     //@{
1026     /**
1027       * This method installs the specified 'advanced' document callback
1028       * handler, thereby allowing the user to customize the processing,
1029       * if they choose to do so. Any number of advanced callback handlers
1030       * maybe installed.
1031       *
1032       * <p>The methods in the advanced callback interface represent
1033       * Xerces-C extensions. There is no specification for this interface.</p>
1034       *
1035       * Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing.
1036       *
1037       * @param toInstall A pointer to the users advanced callback handler.
1038       *
1039       * @see #removeAdvDocHandler
1040       */
1041     void installAdvDocHandler(XMLDocumentHandler* const toInstall);
1042 
1043     /**
1044       * This method removes the 'advanced' document handler callback from
1045       * the underlying parser scanner. If no handler is installed, advanced
1046       * callbacks are not invoked by the scanner.
1047       * @param toRemove A pointer to the advanced callback handler which
1048       *                 should be removed.
1049       *
1050       * Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing.
1051       *
1052       * @see #installAdvDocHandler
1053       */
1054     bool removeAdvDocHandler(XMLDocumentHandler* const toRemove);
1055     //@}
1056 
1057 
1058     // -----------------------------------------------------------------------
1059     //  Progressive scan methods
1060     // -----------------------------------------------------------------------
1061 
1062     /** @name Progressive scan methods */
1063     //@{
1064 
1065     /** Begin a progressive parse operation
1066       *
1067       * This method is used to start a progressive parse on a XML file.
1068       * To continue parsing, subsequent calls must be to the parseNext
1069       * method.
1070       *
1071       * It scans through the prolog and returns a token to be used on
1072       * subsequent scanNext() calls. If the return value is true, then the
1073       * token is legal and ready for further use. If it returns false, then
1074       * the scan of the prolog failed and the token is not going to work on
1075       * subsequent scanNext() calls.
1076       *
1077       * @param systemId A pointer to a Unicode string representing the path
1078       *                 to the XML file to be parsed.
1079       * @param toFill   A token maintaing state information to maintain
1080       *                 internal consistency between invocation of 'parseNext'
1081       *                 calls.
1082       *
1083       * @return 'true', if successful in parsing the prolog. It indicates the
1084       *         user can go ahead with parsing the rest of the file. It
1085       *         returns 'false' to indicate that the parser could parse the
1086       *         prolog (which means the token will not be valid.)
1087       *
1088       * @see #parseNext
1089       * @see #parseFirst(char*,...)
1090       * @see #parseFirst(InputSource&,...)
1091       */
1092     bool parseFirst
1093     (
1094         const   XMLCh* const    systemId
1095         ,       XMLPScanToken&  toFill
1096     );
1097 
1098     /** Begin a progressive parse operation
1099       *
1100       * This method is used to start a progressive parse on a XML file.
1101       * To continue parsing, subsequent calls must be to the parseNext
1102       * method.
1103       *
1104       * It scans through the prolog and returns a token to be used on
1105       * subsequent scanNext() calls. If the return value is true, then the
1106       * token is legal and ready for further use. If it returns false, then
1107       * the scan of the prolog failed and the token is not going to work on
1108       * subsequent scanNext() calls.
1109       *
1110       * @param systemId A pointer to a regular native string representing
1111       *                 the path to the XML file to be parsed.
1112       * @param toFill   A token maintaing state information to maintain
1113       *                 internal consistency between invocation of 'parseNext'
1114       *                 calls.
1115       *
1116       * @return 'true', if successful in parsing the prolog. It indicates the
1117       *         user can go ahead with parsing the rest of the file. It
1118       *         returns 'false' to indicate that the parser could not parse
1119       *         the prolog.
1120       *
1121       * @see #parseNext
1122       * @see #parseFirst(XMLCh*,...)
1123       * @see #parseFirst(InputSource&,...)
1124       */
1125     bool parseFirst
1126     (
1127         const   char* const     systemId
1128         ,       XMLPScanToken&  toFill
1129     );
1130 
1131     /** Begin a progressive parse operation
1132       *
1133       * This method is used to start a progressive parse on a XML file.
1134       * To continue parsing, subsequent calls must be to the parseNext
1135       * method.
1136       *
1137       * It scans through the prolog and returns a token to be used on
1138       * subsequent scanNext() calls. If the return value is true, then the
1139       * token is legal and ready for further use. If it returns false, then
1140       * the scan of the prolog failed and the token is not going to work on
1141       * subsequent scanNext() calls.
1142       *
1143       * @param source   A const reference to the InputSource object which
1144       *                 points to the XML file to be parsed.
1145       * @param toFill   A token maintaing state information to maintain
1146       *                 internal consistency between invocation of 'parseNext'
1147       *                 calls.
1148       *
1149       * @return 'true', if successful in parsing the prolog. It indicates the
1150       *         user can go ahead with parsing the rest of the file. It
1151       *         returns 'false' to indicate that the parser could not parse
1152       *         the prolog.
1153       *
1154       * @see #parseNext
1155       * @see #parseFirst(XMLCh*,...)
1156       * @see #parseFirst(char*,...)
1157       */
1158     bool parseFirst
1159     (
1160         const   InputSource&    source
1161         ,       XMLPScanToken&  toFill
1162     );
1163 
1164     /** Continue a progressive parse operation
1165       *
1166       * This method is used to continue with progressive parsing of
1167       * XML files started by a call to 'parseFirst' method.
1168       *
1169       * It parses the XML file and stops as soon as it comes across
1170       * a XML token (as defined in the XML specification). Relevant
1171       * callback handlers are invoked as required by the SAX
1172       * specification.
1173       *
1174       * @param token A token maintaing state information to maintain
1175       *              internal consistency between invocation of 'parseNext'
1176       *              calls.
1177       *
1178       * @return 'true', if successful in parsing the next XML token.
1179       *         It indicates the user can go ahead with parsing the rest
1180       *         of the file. It returns 'false' to indicate that the parser
1181       *         could not find next token as per the XML specification
1182       *         production rule.
1183       *
1184       * @see #parseFirst(XMLCh*,...)
1185       * @see #parseFirst(char*,...)
1186       * @see #parseFirst(InputSource&,...)
1187       */
1188     bool parseNext(XMLPScanToken& token);
1189 
1190     /** Reset the parser after a progressive parse
1191       *
1192       * If a progressive parse loop exits before the end of the document
1193       * is reached, the parser has no way of knowing this. So it will leave
1194       * open any files or sockets or memory buffers that were in use at
1195       * the time that the parse loop exited.
1196       *
1197       * The next parse operation will cause these open files and such to
1198       * be closed, but the next parse operation might occur at some unknown
1199       * future point. To avoid this problem, you should reset the parser if
1200       * you exit the loop early.
1201       *
1202       * If you exited because of an error, then this cleanup will be done
1203       * for you. Its only when you exit the file prematurely of your own
1204       * accord, because you've found what you wanted in the file most
1205       * likely.
1206       *
1207       * @param token A token maintaing state information to maintain
1208       *              internal consistency between invocation of 'parseNext'
1209       *              calls.
1210       */
1211     void parseReset(XMLPScanToken& token);
1212 
1213     //@}
1214 
1215     // -----------------------------------------------------------------------
1216     //  Grammar preparsing interface
1217     // -----------------------------------------------------------------------
1218 
1219     /** @name Implementation of Grammar preparsing interface's. */
1220     //@{
1221     /**
1222       * Preparse schema grammar (XML Schema, DTD, etc.) via an input source
1223       * object.
1224       *
1225       * This method invokes the preparsing process on a schema grammar XML
1226       * file specified by the SAX InputSource parameter. If the 'toCache' flag
1227       * is enabled, the parser will cache the grammars for re-use. If a grammar
1228       * key is found in the pool, no caching of any grammar will take place.
1229       *
1230       *
1231       * @param source A const reference to the SAX InputSource object which
1232       *               points to the schema grammar file to be preparsed.
1233       * @param grammarType The grammar type (Schema or DTD).
1234       * @param toCache If <code>true</code>, we cache the preparsed grammar,
1235       *                otherwise, no caching. Default is <code>false</code>.
1236       * @return The preparsed schema grammar object (SchemaGrammar or
1237       *         DTDGrammar). That grammar object is owned by the parser.
1238       *
1239       * @exception SAXException Any SAX exception, possibly
1240       *            wrapping another exception.
1241       * @exception XMLException An exception from the parser or client
1242       *            handler code.
1243       * @exception DOMException A DOM exception as per DOM spec.
1244       *
1245       * @see InputSource#InputSource
1246       */
1247     Grammar* loadGrammar(const InputSource& source,
1248                          const Grammar::GrammarType grammarType,
1249                          const bool toCache = false);
1250 
1251     /**
1252       * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
1253       *
1254       * This method invokes the preparsing process on a schema grammar XML
1255       * file specified by the file path parameter. If the 'toCache' flag
1256       * is enabled, the parser will cache the grammars for re-use. If a grammar
1257       * key is found in the pool, no caching of any grammar will take place.
1258       *
1259       *
1260       * @param systemId A const XMLCh pointer to the Unicode string which
1261       *                 contains the path to the XML grammar file to be
1262       *                 preparsed.
1263       * @param grammarType The grammar type (Schema or DTD).
1264       * @param toCache If <code>true</code>, we cache the preparsed grammar,
1265       *                otherwise, no caching. Default is <code>false</code>.
1266       * @return The preparsed schema grammar object (SchemaGrammar or
1267       *         DTDGrammar). That grammar object is owned by the parser.
1268       *
1269       * @exception SAXException Any SAX exception, possibly
1270       *            wrapping another exception.
1271       * @exception XMLException An exception from the parser or client
1272       *            handler code.
1273       * @exception DOMException A DOM exception as per DOM spec.
1274       */
1275     Grammar* loadGrammar(const XMLCh* const systemId,
1276                          const Grammar::GrammarType grammarType,
1277                          const bool toCache = false);
1278 
1279     /**
1280       * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
1281       *
1282       * This method invokes the preparsing process on a schema grammar XML
1283       * file specified by the file path parameter. If the 'toCache' flag
1284       * is enabled, the parser will cache the grammars for re-use. If a grammar
1285       * key is found in the pool, no caching of any grammar will take place.
1286       *
1287       *
1288       * @param systemId A const char pointer to a native string which contains
1289       *                 the path to the XML grammar file to be preparsed.
1290       * @param grammarType The grammar type (Schema or DTD).
1291       * @param toCache If <code>true</code>, we cache the preparsed grammar,
1292       *                otherwise, no caching. Default is <code>false</code>.
1293       * @return The preparsed schema grammar object (SchemaGrammar or
1294       *         DTDGrammar). That grammar object is owned by the parser.
1295       *
1296       * @exception SAXException Any SAX exception, possibly
1297       *            wrapping another exception.
1298       * @exception XMLException An exception from the parser or client
1299       *            handler code.
1300       * @exception DOMException A DOM exception as per DOM spec.
1301       */
1302     Grammar* loadGrammar(const char* const systemId,
1303                          const Grammar::GrammarType grammarType,
1304                          const bool toCache = false);
1305 
1306     /**
1307       * This method allows the user to reset the pool of cached grammars.
1308       */
1309     void resetCachedGrammarPool();
1310 
1311     //@}
1312 
1313 
1314     // -----------------------------------------------------------------------
1315     //  Implementation of the SAX Parser interface
1316     // -----------------------------------------------------------------------
1317 
1318     /** @name Implementation of SAX 1.0 Parser interface's. */
1319     //@{
1320     /**
1321       * This method invokes the parsing process on the XML file specified
1322       * by the InputSource parameter.
1323       *
1324       * @param source A const reference to the InputSource object which
1325       *               points to the XML file to be parsed.
1326       *
1327       * @see Parser#parse(InputSource)
1328       */
1329     virtual void parse(const InputSource& source);
1330 
1331     /**
1332       * This method invokes the parsing process on the XML file specified by
1333       * the Unicode string parameter 'systemId'.
1334       *
1335       * @param systemId A const XMLCh pointer to the Unicode string which
1336       *                 contains the path to the XML file to be parsed.
1337       *
1338       * @see Parser#parse(XMLCh*)
1339       */
1340     virtual void parse(const XMLCh* const systemId);
1341 
1342     /**
1343       * This method invokes the parsing process on the XML file specified by
1344       * the native char* string parameter 'systemId'.
1345       *
1346       * @param systemId A const char pointer to a native string which
1347       *                 contains the path to the XML file to be parsed.
1348       */
1349     virtual void parse(const char* const systemId);
1350 
1351     /**
1352       * This method installs the user specified SAX Document Handler
1353       * callback function on parser.
1354       *
1355       * @param handler A pointer to the document handler to be called
1356       *                when the parser comes across 'document' events
1357       *                as per the SAX specification.
1358       *
1359       * @see Parser#parse(char*)
1360       */
1361     virtual void setDocumentHandler(DocumentHandler* const handler);
1362 
1363     /**
1364       * This method installs the user specified DTD handler on the parser.
1365       *
1366       * @param handler A pointer to the DTD handler to be called
1367       *                when the parser comes across 'DTD' events
1368       *                as per the SAX specification.
1369       *
1370       * @see Parser#setDTDHandler
1371       */
1372     virtual void setDTDHandler(DTDHandler* const handler);
1373 
1374     /**
1375       * This method installs the user specified error handler on
1376       * the parser.
1377       *
1378       * @param handler A pointer to the error handler to be called
1379       *                when the parser comes across 'error' events
1380       *                as per the SAX specification.
1381       *
1382       * @see Parser#setErrorHandler
1383       */
1384     virtual void setErrorHandler(ErrorHandler* const handler);
1385 
1386     /**
1387       * This method installs the user specified PSVI handler on
1388       * the parser.
1389       *
1390       * @param handler A pointer to the PSVI handler to be called
1391       *                when the parser comes across 'PSVI' events
1392       *                as per the schema specification.
1393       *
1394       * @see Parser#setPSVIHandler
1395       */
1396     virtual void setPSVIHandler(PSVIHandler* const handler);
1397 
1398     /**
1399       * This method installs the user specified entity resolver on the
1400       * parser. It allows applications to trap and redirect calls to
1401       * external entities.
1402       *
1403       * <i>Any previously set entity resolver is merely dropped, since the parser
1404       * does not own them.  If both setEntityResolver and setXMLEntityResolver
1405       * are called, then the last one is used.</i>
1406       *
1407       * @param resolver A pointer to the entity resolver to be called
1408       *                 when the parser comes across references to
1409       *                 entities in the XML file.
1410       *
1411       * @see Parser#setEntityResolver
1412       */
1413     virtual void setEntityResolver(EntityResolver* const resolver);
1414 
1415     /**
1416       * This method installs the user specified entity resolver on the
1417       * parser. It allows applications to trap and redirect calls to
1418       * external entities.
1419       *
1420       * <i>Any previously set entity resolver is merely dropped, since the parser
1421       * does not own them.  If both setEntityResolver and setXMLEntityResolver
1422       * are called, then the last one is used.</i>
1423       *
1424       * @param resolver A pointer to the entity resolver to be called
1425       *                 when the parser comes across references to
1426       *                 entities in the XML file.
1427       *
1428       * @see Parser#setXMLEntityResolver
1429       */
1430     virtual void setXMLEntityResolver(XMLEntityResolver* const resolver);
1431 
1432     //@}
1433 
1434 
1435     // -----------------------------------------------------------------------
1436     //  Implementation of the XMLDocumentHandler interface
1437     // -----------------------------------------------------------------------
1438 
1439     /** @name Implementation of the XMLDocumentHandler Interface. */
1440     //@{
1441     /**
1442       * This method is used to report all the characters scanned
1443       * by the parser. The driver will invoke the 'characters'
1444       * method of the user installed SAX Document Handler.
1445       *
1446       * <p>If any advanced callback handlers are installed, the
1447       * corresponding 'docCharacters' method will also be invoked.</p>
1448       *
1449       * @param chars   A const pointer to a Unicode string representing the
1450       *                character data.
1451       * @param length  The length of the Unicode string returned in 'chars'.
1452       * @param cdataSection  A flag indicating if the characters represent
1453       *                      content from the CDATA section.
1454       * @see DocumentHandler#characters
1455       */
1456     virtual void docCharacters
1457     (
1458         const   XMLCh* const    chars
1459         , const XMLSize_t       length
1460         , const bool            cdataSection
1461     );
1462 
1463     /**
1464       * This method is used to report any comments scanned by the parser.
1465       * This method is a no-op unless, unless an advanced callback handler
1466       * is installed, in which case the corresponding 'docComment' method
1467       * is invoked.
1468       *
1469       * @param comment A const pointer to a null terminated Unicode
1470       *                string representing the comment text.
1471       */
1472     virtual void docComment
1473     (
1474         const   XMLCh* const    comment
1475     );
1476 
1477     /**
1478       * This method is used to report any PI scanned by the parser.
1479       *
1480       * <p>Any PI's occurring before any 'content' are not reported
1481       * to any SAX handler as per the specification. However, all
1482       * PI's within content are reported via the SAX Document Handler's
1483       * 'processingInstruction' method.
1484       *
1485       * <p>If any advanced callback handlers are installed, the
1486       * corresponding 'docPI' method will be invoked.</p>
1487       *
1488       * @param target A const pointer to a Unicode string representing the
1489       *               target of the PI declaration.
1490       * @param data   A const pointer to a Unicode string representing the
1491       *               data of the PI declaration. See the PI production rule
1492       *               in the XML specification for details.
1493       *
1494       * @see DocumentHandler#processingInstruction
1495       */
1496     virtual void docPI
1497     (
1498         const   XMLCh* const    target
1499         , const XMLCh* const    data
1500     );
1501 
1502     /**
1503       * This method is used to indicate the end of root element
1504       * was just scanned by the parser. Corresponding 'endDocument'
1505       * method of the user installed SAX Document Handler will also
1506       * be invoked.
1507       *
1508       * <p>In addition, if any advanced callback handlers are installed,
1509       * the corresponding 'endDocument' method is invoked.</p>
1510       *
1511       * @see DocumentHandler#endDocument
1512       */
1513     virtual void endDocument();
1514 
1515     /**
1516       * This method is used to indicate the end tag of an element.
1517       * The driver will invoke the corresponding 'endElement' method of
1518       * the SAX Document Handler interface.
1519       *
1520       * <p>If any advanced callback handlers are installed, the
1521       * corresponding 'endElement' method is also invoked.</p>
1522       *
1523       * @param elemDecl A const reference to the object containing element
1524       *                 declaration information.
1525       * @param urlId    An id referring to the namespace prefix, if
1526       *                 namespaces setting is switched on.
1527       * @param isRoot   A flag indicating whether this element was the
1528       *                 root element.
1529       * @param elemPrefix A const pointer to a Unicode string containing
1530       *                   the namespace prefix for this element. Applicable
1531       *                   only when namespace processing is enabled.
1532       * @see DocumentHandler#endElement
1533       */
1534     virtual void endElement
1535     (
1536         const   XMLElementDecl& elemDecl
1537         , const unsigned int    urlId
1538         , const bool            isRoot
1539         , const XMLCh* const    elemPrefix
1540     );
1541 
1542     /**
1543       * This method is used to indicate that an end of an entity reference
1544       * was just scanned.
1545       *
1546       * <p>If any advanced callback handlers are installed, the
1547       * corresponding 'endEntityReference' method is invoked.</p>
1548       *
1549       * @param entDecl A const reference to the object containing the
1550       *                entity declaration information.
1551       */
1552     virtual void endEntityReference
1553     (
1554         const   XMLEntityDecl&  entDecl
1555     );
1556 
1557     /**
1558       * This method is used to report all the whitespace characters,
1559       * which are determined to be 'ignorable'. This distinction
1560       * between characters is only made, if validation is enabled.
1561       * Corresponding 'ignorableWhitespace' method of the user installed
1562       * SAX Document Handler interface is called.
1563       *
1564       * <p>Any whitespace before content is not reported to the SAX
1565       * Document Handler method, as per the SAX specification.
1566       * However, if any advanced callback handlers are installed, the
1567       * corresponding 'ignorableWhitespace' method is invoked.</p>
1568       *
1569       * @param chars   A const pointer to a Unicode string representing the
1570       *                ignorable whitespace character data.
1571       * @param length  The length of the Unicode string 'chars'.
1572       * @param cdataSection  A flag indicating if the characters represent
1573       *                      content from the CDATA section.
1574       * @see DocumentHandler#ignorableWhitespace
1575       */
1576     virtual void ignorableWhitespace
1577     (
1578         const   XMLCh* const    chars
1579         , const XMLSize_t       length
1580         , const bool            cdataSection
1581     );
1582 
1583     /**
1584       * This method allows the user installed Document Handler and
1585       * any advanced callback handlers to 'reset' themselves.
1586       */
1587     virtual void resetDocument();
1588 
1589     /**
1590       * This method is used to report the start of the parsing process.
1591       * The corresponding user installed SAX Document Handler's method
1592       * 'startDocument' is invoked.
1593       *
1594       * <p>If any advanced callback handlers are installed, then the
1595       * corresponding 'startDocument' method is also called.</p>
1596       *
1597       * @see DocumentHandler#startDocument
1598       */
1599     virtual void startDocument();
1600 
1601     /**
1602       * This method is used to report the start of an element. It is
1603       * called at the end of the element, by which time all attributes
1604       * specified are also parsed. The corresponding user installed
1605       * SAX Document Handler's method 'startElement' is invoked.
1606       *
1607       * <p>If any advanced callback handlers are installed, then the
1608       * corresponding 'startElement' method is also called.</p>
1609       *
1610       * @param elemDecl A const reference to the object containing element
1611       *                 declaration information.
1612       * @param urlId    An id referring to the namespace prefix, if
1613       *                 namespaces setting is switched on.
1614       * @param elemPrefix A const pointer to a Unicode string containing
1615       *                   the namespace prefix for this element. Applicable
1616       *                   only when namespace processing is enabled.
1617       * @param attrList  A const reference to the object containing the
1618       *                  list of attributes just scanned for this element.
1619       * @param attrCount A count of number of attributes in the list
1620       *                  specified by the parameter 'attrList'.
1621       * @param isEmpty  A flag indicating whether this is an empty element
1622       *                 or not.
1623       * @param isRoot   A flag indicating whether this element was the
1624       *                 root element.
1625       * @see DocumentHandler#startElement
1626       */
1627     virtual void startElement
1628     (
1629         const   XMLElementDecl&         elemDecl
1630         , const unsigned int            urlId
1631         , const XMLCh* const            elemPrefix
1632         , const RefVectorOf<XMLAttr>&   attrList
1633         , const XMLSize_t               attrCount
1634         , const bool                    isEmpty
1635         , const bool                    isRoot
1636     );
1637 
1638     /**
1639       * This method is used to indicate the start of an entity reference.
1640       *
1641       * <p>If any advanced callback handlers are installed, the
1642       * corresponding 'endEntityReference' method is invoked.</p>
1643       *
1644       * @param entDecl A const reference to the object containing the
1645       *                entity declaration information.
1646       */
1647     virtual void startEntityReference
1648     (
1649         const   XMLEntityDecl&  entDecl
1650     );
1651 
1652     /**
1653       * This method is used to report the XML decl scanned by the parser.
1654       * Refer to the XML specification to see the meaning of parameters.
1655       *
1656       * <b>This method is a no-op for this SAX driver
1657       * implementation.</b>
1658       *
1659       * @param versionStr A const pointer to a Unicode string representing
1660       *                   version string value.
1661       * @param encodingStr A const pointer to a Unicode string representing
1662       *                    the encoding string value.
1663       * @param standaloneStr A const pointer to a Unicode string
1664       *                      representing the standalone string value.
1665       * @param actualEncodingStr A const pointer to a Unicode string
1666       *                          representing the actual encoding string
1667       *                          value.
1668       */
1669     virtual void XMLDecl
1670     (
1671         const   XMLCh* const    versionStr
1672         , const XMLCh* const    encodingStr
1673         , const XMLCh* const    standaloneStr
1674         , const XMLCh* const    actualEncodingStr
1675     );
1676     //@}
1677 
1678 
1679     // -----------------------------------------------------------------------
1680     //  Implementation of the XMLErrorReporter interface
1681     // -----------------------------------------------------------------------
1682 
1683     /** @name Implementation of the XMLErrorReporter Interface. */
1684     //@{
1685     /**
1686       * This method is used to report back errors found while parsing the
1687       * XML file. The driver will call the corresponding user installed
1688       * SAX Error Handler methods: 'fatal', 'error', 'warning' depending
1689       * on the severity of the error. This classification is defined by
1690       * the XML specification.
1691       *
1692       * @param errCode An integer code for the error.
1693       * @param msgDomain A const pointer to an Unicode string representing
1694       *                  the message domain to use.
1695       * @param errType An enumeration classifying the severity of the error.
1696       * @param errorText A const pointer to an Unicode string representing
1697       *                  the text of the error message.
1698       * @param systemId  A const pointer to an Unicode string representing
1699       *                  the system id of the XML file where this error
1700       *                  was discovered.
1701       * @param publicId  A const pointer to an Unicode string representing
1702       *                  the public id of the XML file where this error
1703       *                  was discovered.
1704       * @param lineNum   The line number where the error occurred.
1705       * @param colNum    The column number where the error occurred.
1706       * @see ErrorHandler
1707       */
1708     virtual void error
1709     (
1710         const   unsigned int                errCode
1711         , const XMLCh* const                msgDomain
1712         , const XMLErrorReporter::ErrTypes  errType
1713         , const XMLCh* const                errorText
1714         , const XMLCh* const                systemId
1715         , const XMLCh* const                publicId
1716         , const XMLFileLoc                  lineNum
1717         , const XMLFileLoc                  colNum
1718     );
1719 
1720     /**
1721       * This method allows the user installed Error Handler
1722       * callback to 'reset' itself.
1723       *
1724       * <b>This method is a no-op for this SAX driver
1725       * implementation.</b>
1726       *
1727       */
1728     virtual void resetErrors();
1729     //@}
1730 
1731 
1732     // -----------------------------------------------------------------------
1733     //  Implementation of the XMLEntityHandler interface
1734     // -----------------------------------------------------------------------
1735 
1736     /** @name Implementation of the XMLEntityHandler Interface. */
1737     //@{
1738     /**
1739       * This method is used to indicate the end of parsing of an external
1740       * entity file.
1741       *
1742       * <b>This method is a no-op for this SAX driver
1743       * implementation.</b>
1744       *
1745       * @param inputSource A const reference to the InputSource object
1746       *                    which points to the XML file being parsed.
1747       * @see InputSource
1748       */
1749     virtual void endInputSource(const InputSource& inputSource);
1750 
1751     /**
1752       * This method allows an installed XMLEntityHandler to further
1753       * process any system id's of external entities encountered in
1754       * the XML file being parsed, such as redirection etc.
1755       *
1756       * <b>This method always returns 'false'
1757       * for this SAX driver implementation.</b>
1758       *
1759       * @param systemId  A const pointer to an Unicode string representing
1760       *                  the system id scanned by the parser.
1761       * @param toFill    A pointer to a buffer in which the application
1762       *                  processed system id is stored.
1763       * @return 'true', if any processing is done, 'false' otherwise.
1764       */
1765     virtual bool expandSystemId
1766     (
1767         const   XMLCh* const    systemId
1768         ,       XMLBuffer&      toFill
1769     );
1770 
1771     /**
1772       * This method allows the installed XMLEntityHandler to reset
1773       * itself.
1774       *
1775       * <b>This method is a no-op for this SAX driver
1776       * implementation.</b>
1777       */
1778     virtual void resetEntities();
1779 
1780     /** Resolve a public/system id
1781       *
1782       * This method allows a user installed entity handler to further
1783       * process any pointers to external entities. The applications can
1784       * implement 'redirection' via this callback.
1785       *
1786       * @param resourceIdentifier An object containing the type of
1787       *        resource to be resolved and the associated data members
1788       *        corresponding to this type.
1789       * @return The value returned by the user installed resolveEntity
1790       *         method or NULL otherwise to indicate no processing was done.
1791       *         The returned InputSource is owned by the parser which is
1792       *         responsible to clean up the memory.
1793       * @see XMLEntityHandler
1794       * @see XMLEntityResolver
1795       */
1796     virtual InputSource* resolveEntity
1797     (
1798         XMLResourceIdentifier* resourceIdentifier
1799     );
1800 
1801     /**
1802       * This method is used to indicate the start of parsing an
1803       * external entity file.
1804       *
1805       * <b>This method is a no-op for this SAX driver
1806       * implementation.</b>
1807       *
1808       * @param inputSource A const reference to the InputSource object
1809       *                    which points to the external entity
1810       *                    being parsed.
1811       */
1812     virtual void startInputSource(const InputSource& inputSource);
1813     //@}
1814 
1815 
1816     // -----------------------------------------------------------------------
1817     //  Implementation of the Deprecated DocTypeHandler Interface
1818     // -----------------------------------------------------------------------
1819     /** @name Implementation of the deprecated DocTypeHandler Interface */
1820     //@{
1821     /**
1822       * This method is used to report an attribute definition.
1823       *
1824       * <b>This method is a no-op for this SAX
1825       * driver implementation.</b>
1826       *
1827       * @param elemDecl A const reference to the object containing information
1828       *                 about the element whose attribute definition was just
1829       *                 parsed.
1830       * @param attDef   A const reference to the object containing information
1831       *                 attribute definition.
1832       * @param ignore   The flag indicating whether this attribute definition
1833       *                 was ignored by the parser or not.
1834       */
1835     virtual void attDef
1836     (
1837         const   DTDElementDecl& elemDecl
1838         , const DTDAttDef&      attDef
1839         , const bool            ignore
1840     );
1841 
1842     /**
1843       * This method is used to report a comment occurring within the DTD.
1844       *
1845       * <b>This method is a no-op for this SAX driver
1846       * implementation.</b>
1847       *
1848       * @param comment  A const pointer to a Unicode string representing the
1849       *                 text of the comment just parsed.
1850       */
1851     virtual void doctypeComment
1852     (
1853         const   XMLCh* const    comment
1854     );
1855 
1856     /**
1857       * This method is used to report the DOCTYPE declaration.
1858       *
1859       * <b>This method is a no-op for this SAX driver
1860       * implementation.</b>
1861       *
1862       * @param elemDecl A const reference to the object containing information
1863       *                 about the root element definition declaration of the
1864       *                 XML document being parsed.
1865       * @param publicId A const pointer to a Unicode string representing the
1866       *                 public id of the DTD file.
1867       * @param systemId A const pointer to a Unicode string representing the
1868       *                 system id of the DTD file.
1869       * @param hasIntSubset A flag indicating if this XML file contains any
1870       *                     internal subset.
1871       * @param hasExtSubset A flag indicating if this XML file contains any
1872       *                     external subset. Default is false.
1873       */
1874     virtual void doctypeDecl
1875     (
1876         const   DTDElementDecl& elemDecl
1877         , const XMLCh* const    publicId
1878         , const XMLCh* const    systemId
1879         , const bool            hasIntSubset
1880         , const bool            hasExtSubset = false
1881     );
1882 
1883     /**
1884       * This method is used to report any PI declarations
1885       * occurring inside the DTD definition block.
1886       *
1887       * <b>This method is a no-op for this SAX driver
1888       * implementation.</b>
1889       *
1890       * @param target A const pointer to a Unicode string representing the
1891       *               target of the PI declaration.
1892       * @param data   A const pointer to a Unicode string representing the
1893       *               data of the PI declaration. See the PI production rule
1894       *               in the XML specification for details.
1895       */
1896     virtual void doctypePI
1897     (
1898         const   XMLCh* const    target
1899         , const XMLCh* const    data
1900     );
1901 
1902     /**
1903       * This method is used to report any whitespaces
1904       * occurring inside the DTD definition block.
1905       *
1906       * <b>This method is a no-op for this SAX driver
1907       * implementation.</b>
1908       *
1909       * @param chars  A const pointer to a Unicode string representing the
1910       *               whitespace characters.
1911       * @param length The length of the whitespace Unicode string.
1912       */
1913     virtual void doctypeWhitespace
1914     (
1915         const   XMLCh* const    chars
1916         , const XMLSize_t       length
1917     );
1918 
1919     /**
1920       * This method is used to report an element declarations
1921       * successfully scanned by the parser.
1922       *
1923       * <b>This method is a no-op for this SAX driver
1924       * implementation.</b>
1925       *
1926       * @param decl   A const reference to the object containing element
1927       *               declaration information.
1928       * @param isIgnored The flag indicating whether this definition was
1929       *                  ignored by the parser or not.
1930       */
1931     virtual void elementDecl
1932     (
1933         const   DTDElementDecl& decl
1934         , const bool            isIgnored
1935     );
1936 
1937     /**
1938       * This method is used to report the end of an attribute
1939       * list declaration for an element.
1940       *
1941       * <b>This method is a no-op for this SAX driver
1942       * implementation.</b>
1943       *
1944       * @param elemDecl A const reference to the object containing element
1945       *                 declaration information.
1946       */
1947     virtual void endAttList
1948     (
1949         const   DTDElementDecl& elemDecl
1950     );
1951 
1952     /**
1953       * This method is used to report the end of the internal subset.
1954       *
1955       * <b>This method is a no-op for this SAX driver
1956       * implementation.</b>
1957       */
1958     virtual void endIntSubset();
1959 
1960     /**
1961       * This method is used to report the end of the external subset.
1962       *
1963       * <b>This method is a no-op for this SAX driver
1964       * implementation.</b>
1965       */
1966     virtual void endExtSubset();
1967 
1968     /**
1969       * This method is used to report any entity declarations.
1970       * For unparsed entities, this driver will invoke the
1971       * SAX DTDHandler::unparsedEntityDecl callback.
1972       *
1973       * @param entityDecl A const reference to the object containing
1974       *                   the entity declaration information.
1975       * @param isPEDecl  The flag indicating whether this was a
1976       *                  parameter entity declaration or not.
1977       * @param isIgnored The flag indicating whether this definition
1978       *                  was ignored by the parser or not.
1979       *
1980       * @see DTDHandler#unparsedEntityDecl
1981       */
1982     virtual void entityDecl
1983     (
1984         const   DTDEntityDecl&  entityDecl
1985         , const bool            isPEDecl
1986         , const bool            isIgnored
1987     );
1988 
1989     /**
1990       * This method allows the user installed DTD handler to
1991       * reset itself.
1992       */
1993     virtual void resetDocType();
1994 
1995     /**
1996       * This method is used to report any notation declarations.
1997       * If there is a user installed DTDHandler, then the driver will
1998       * invoke the SAX DTDHandler::notationDecl callback.
1999       *
2000       * @param notDecl A const reference to the object containing the notation
2001       *                declaration information.
2002       * @param isIgnored The flag indicating whether this definition was ignored
2003       *                  by the parser or not.
2004       *
2005       * @see DTDHandler#notationDecl
2006       */
2007     virtual void notationDecl
2008     (
2009         const   XMLNotationDecl&    notDecl
2010         , const bool                isIgnored
2011     );
2012 
2013     /**
2014       * This method is used to indicate the start of an element's attribute
2015       * list declaration.
2016       *
2017       * <b>This method is a no-op for this SAX driver
2018       * implementation.</b>
2019       *
2020       * @param elemDecl A const reference to the object containing element
2021       *                 declaration information.
2022       */
2023     virtual void startAttList
2024     (
2025         const   DTDElementDecl& elemDecl
2026     );
2027 
2028     /**
2029       * This method is used indicate the start of the internal subset.
2030       *
2031       * <b>This method is a no-op for this SAX driver
2032       * implementation.</b>
2033       */
2034     virtual void startIntSubset();
2035 
2036     /**
2037       * This method is used indicate the start of the external subset.
2038       *
2039       * <b>This method is a no-op for this SAX driver
2040       * implementation.</b>
2041       */
2042     virtual void startExtSubset();
2043 
2044     /**
2045       * This method is used to report the TextDecl. Refer to the XML
2046       * specification for the syntax of a TextDecl.
2047       *
2048       * <b>This method is a no-op for this SAX driver
2049       * implementation.</b>
2050       *
2051       * @param versionStr A const pointer to a Unicode string representing
2052       *                   the version number of the 'version' clause.
2053       * @param encodingStr A const pointer to a Unicode string representing
2054       *                    the encoding name of the 'encoding' clause.
2055       */
2056     virtual void TextDecl
2057     (
2058         const   XMLCh* const    versionStr
2059         , const XMLCh* const    encodingStr
2060     );
2061     //@}
2062 
2063 protected :
2064     // -----------------------------------------------------------------------
2065     //  Protected Methods
2066     // -----------------------------------------------------------------------
2067     /**
2068       * This method returns a reference to the underlying scanner object.
2069       * It allows read only access to data maintained in the scanner.
2070       *
2071       * @return A const reference to the underlying scanner object.
2072       */
2073     const XMLScanner& getScanner() const;
2074 
2075     /** Get the Grammar resolver
2076       *
2077       * This provides derived classes with access to the grammar resolver.
2078       */
2079     GrammarResolver* getGrammarResolver() const;
2080 
2081 
2082 private:
2083     // -----------------------------------------------------------------------
2084     //  Unimplemented constructors and operators
2085     // -----------------------------------------------------------------------
2086     SAXParser(const SAXParser&);
2087     SAXParser& operator=(const SAXParser&);
2088 
2089     // -----------------------------------------------------------------------
2090     //  Initialize/Cleanup methods
2091     // -----------------------------------------------------------------------
2092     void initialize();
2093     void cleanUp();
2094     void resetInProgress();
2095 
2096     // -----------------------------------------------------------------------
2097     //  Private data members
2098     //
2099     //  fAttrList
2100     //      A temporary implementation of the basic SAX attribute list
2101     //      interface. We use this one over and over on each startElement
2102     //      event to allow SAX-like access to the element attributes.
2103     //
2104     //  fDocHandler
2105     //      The installed SAX doc handler, if any. Null if none.
2106     //
2107     //  fDTDHandler
2108     //      The installed SAX DTD handler, if any. Null if none.
2109     //
2110     //  fElemDepth
2111     //      This is used to track the element nesting depth, so that we can
2112     //      know when we are inside content. This is so we can ignore char
2113     //      data outside of content.
2114     //
2115     //  fEntityResolver
2116     //      The installed SAX entity handler, if any. Null if none.
2117     //
2118     //  fErrorHandler
2119     //      The installed SAX error handler, if any. Null if none.
2120     //
2121     //  fPSVIHandler
2122     //      The installed PSVI handler, if any. Null if none.
2123     //
2124     //  fAdvDHCount
2125     //  fAdvDHList
2126     //  fAdvDHListSize
2127     //      This is an array of pointers to XMLDocumentHandlers, which is
2128     //      how we see installed advanced document handlers. There will
2129     //      usually not be very many at all, so a simple array is used
2130     //      instead of a collection, for performance. It will grow if needed,
2131     //      but that is unlikely.
2132     //
2133     //      The count is how many handlers are currently installed. The size
2134     //      is how big the array itself is (for expansion purposes.) When
2135     //      count == size, is time to expand.
2136     //
2137     //  fParseInProgress
2138     //      This flag is set once a parse starts. It is used to prevent
2139     //      multiple entrance or reentrance of the parser.
2140     //
2141     //  fScanner
2142     //      The scanner being used by this parser. It is created internally
2143     //      during construction.
2144     //
2145     //   fGrammarPool
2146     //      The grammar pool passed from external application (through derivatives).
2147     //      which could be 0, not owned.
2148     //
2149     // -----------------------------------------------------------------------
2150     bool                 fParseInProgress;
2151     XMLSize_t            fElemDepth;
2152     XMLSize_t            fAdvDHCount;
2153     XMLSize_t            fAdvDHListSize;
2154     VecAttrListImpl      fAttrList;
2155     DocumentHandler*     fDocHandler;
2156     DTDHandler*          fDTDHandler;
2157     EntityResolver*      fEntityResolver;
2158     XMLEntityResolver*   fXMLEntityResolver;
2159     ErrorHandler*        fErrorHandler;
2160     PSVIHandler*         fPSVIHandler;
2161     XMLDocumentHandler** fAdvDHList;
2162     XMLScanner*          fScanner;
2163     GrammarResolver*     fGrammarResolver;
2164     XMLStringPool*       fURIStringPool;
2165     XMLValidator*        fValidator;
2166     MemoryManager*       fMemoryManager;
2167     XMLGrammarPool*      fGrammarPool;
2168     XMLBuffer            fElemQNameBuf;
2169 };
2170 
2171 
2172 // ---------------------------------------------------------------------------
2173 //  SAXParser: Getter methods
2174 // ---------------------------------------------------------------------------
2175 inline DocumentHandler* SAXParser::getDocumentHandler()
2176 {
2177     return fDocHandler;
2178 }
2179 
2180 inline const DocumentHandler* SAXParser::getDocumentHandler() const
2181 {
2182     return fDocHandler;
2183 }
2184 
2185 inline EntityResolver* SAXParser::getEntityResolver()
2186 {
2187     return fEntityResolver;
2188 }
2189 
2190 inline XMLEntityResolver* SAXParser::getXMLEntityResolver()
2191 {
2192     return fXMLEntityResolver;
2193 }
2194 
2195 inline const XMLEntityResolver* SAXParser::getXMLEntityResolver() const
2196 {
2197     return fXMLEntityResolver;
2198 }
2199 
2200 inline const EntityResolver* SAXParser::getEntityResolver() const
2201 {
2202     return fEntityResolver;
2203 }
2204 
2205 inline ErrorHandler* SAXParser::getErrorHandler()
2206 {
2207     return fErrorHandler;
2208 }
2209 
2210 inline const ErrorHandler* SAXParser::getErrorHandler() const
2211 {
2212     return fErrorHandler;
2213 }
2214 
2215 inline PSVIHandler* SAXParser::getPSVIHandler()
2216 {
2217     return fPSVIHandler;
2218 }
2219 
2220 inline const PSVIHandler* SAXParser::getPSVIHandler() const
2221 {
2222     return fPSVIHandler;
2223 }
2224 
2225 inline const XMLScanner& SAXParser::getScanner() const
2226 {
2227     return *fScanner;
2228 }
2229 
2230 inline GrammarResolver* SAXParser::getGrammarResolver() const
2231 {
2232     return fGrammarResolver;
2233 }
2234 
2235 XERCES_CPP_NAMESPACE_END
2236 
2237 #endif