Back to home page

EIC code displayed by LXR

 
 

    


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

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_XMLSCANNER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLSCANNER_HPP
0024 
0025 #include <xercesc/framework/XMLBufferMgr.hpp>
0026 #include <xercesc/framework/XMLErrorCodes.hpp>
0027 #include <xercesc/framework/XMLRefInfo.hpp>
0028 #include <xercesc/util/PlatformUtils.hpp>
0029 #include <xercesc/util/NameIdPool.hpp>
0030 #include <xercesc/util/RefHashTableOf.hpp>
0031 #include <xercesc/util/SecurityManager.hpp>
0032 #include <xercesc/internal/ReaderMgr.hpp>
0033 #include <xercesc/internal/ElemStack.hpp>
0034 #include <xercesc/validators/DTD/DTDEntityDecl.hpp>
0035 #include <xercesc/framework/XMLAttr.hpp>
0036 #include <xercesc/framework/ValidationContext.hpp>
0037 #include <xercesc/validators/common/GrammarResolver.hpp>
0038 
0039 XERCES_CPP_NAMESPACE_BEGIN
0040 
0041 class InputSource;
0042 class XMLDocumentHandler;
0043 class XMLEntityHandler;
0044 class ErrorHandler;
0045 class DocTypeHandler;
0046 class XMLPScanToken;
0047 class XMLStringPool;
0048 class Grammar;
0049 class XMLValidator;
0050 class MemoryManager;
0051 class PSVIHandler;
0052 
0053 
0054 struct PSVIElemContext
0055 {
0056     bool               fIsSpecified;
0057     bool               fErrorOccurred;
0058     int                fElemDepth;
0059     int                fFullValidationDepth;
0060     int                fNoneValidationDepth;
0061     DatatypeValidator* fCurrentDV;
0062     ComplexTypeInfo*   fCurrentTypeInfo;
0063     const XMLCh*       fNormalizedValue;
0064 };
0065 
0066 //  This is the mondo scanner class, which does the vast majority of the
0067 //  work of parsing. It handles reading in input and spitting out events
0068 //  to installed handlers.
0069 class XMLPARSER_EXPORT XMLScanner : public XMemory, public XMLBufferFullHandler
0070 {
0071 public :
0072     // -----------------------------------------------------------------------
0073     //  Public class types
0074     //
0075     //  NOTE: These should really be private, but some of the compilers we
0076     //  have to deal with are too stupid to understand this.
0077     //
0078     //  DeclTypes
0079     //      Used by scanXMLDecl() to know what type of decl it should scan.
0080     //      Text decls have slightly different rules from XMLDecls.
0081     //
0082     //  EntityExpRes
0083     //      These are the values returned from the entity expansion method,
0084     //      to indicate how it went.
0085     //
0086     //  XMLTokens
0087     //      These represent the possible types of input we can get while
0088     //      scanning content.
0089     //
0090     //  ValScheme
0091     //      This indicates what the scanner should do in terms of validation.
0092     //      'Auto' means if there is any int/ext subset, then validate. Else,
0093     //      don't.
0094     // -----------------------------------------------------------------------
0095     enum DeclTypes
0096     {
0097         Decl_Text
0098         , Decl_XML
0099     };
0100 
0101     enum EntityExpRes
0102     {
0103         EntityExp_Pushed
0104         , EntityExp_Returned
0105         , EntityExp_Failed
0106     };
0107 
0108     enum XMLTokens
0109     {
0110         Token_CData
0111         , Token_CharData
0112         , Token_Comment
0113         , Token_EndTag
0114         , Token_EOF
0115         , Token_PI
0116         , Token_StartTag
0117         , Token_Unknown
0118     };
0119 
0120     enum ValSchemes
0121     {
0122         Val_Never
0123         , Val_Always
0124         , Val_Auto
0125     };
0126 
0127 
0128     // -----------------------------------------------------------------------
0129     //  Constructors and Destructor
0130     // -----------------------------------------------------------------------
0131     XMLScanner
0132     (
0133         XMLValidator* const valToAdopt
0134         , GrammarResolver* const grammarResolver
0135         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0136     );
0137     XMLScanner
0138     (
0139         XMLDocumentHandler* const  docHandler
0140         , DocTypeHandler* const    docTypeHandler
0141         , XMLEntityHandler* const  entityHandler
0142         , XMLErrorReporter* const  errReporter
0143         , XMLValidator* const      valToAdopt
0144         , GrammarResolver* const grammarResolver
0145         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0146     );
0147     virtual ~XMLScanner();
0148 
0149 
0150     // -----------------------------------------------------------------------
0151     //  Error emitter methods
0152     // -----------------------------------------------------------------------
0153     bool emitErrorWillThrowException(const XMLErrs::Codes toEmit);
0154     void emitError(const XMLErrs::Codes toEmit);
0155     void emitError
0156     (
0157         const   XMLErrs::Codes    toEmit
0158         , const XMLCh* const        text1
0159         , const XMLCh* const        text2 = 0
0160         , const XMLCh* const        text3 = 0
0161         , const XMLCh* const        text4 = 0
0162     );
0163     void emitError
0164     (
0165         const   XMLErrs::Codes    toEmit
0166         , const char* const         text1
0167         , const char* const         text2 = 0
0168         , const char* const         text3 = 0
0169         , const char* const         text4 = 0
0170     );
0171     void emitError
0172     (
0173         const   XMLErrs::Codes    toEmit
0174         , const XMLExcepts::Codes   originalErrorCode
0175         , const XMLCh* const        text1 = 0
0176         , const XMLCh* const        text2 = 0
0177         , const XMLCh* const        text3 = 0
0178         , const XMLCh* const        text4 = 0
0179 
0180     );
0181 
0182     // -----------------------------------------------------------------------
0183     //  Implementation of XMLBufferFullHandler interface
0184     // -----------------------------------------------------------------------
0185 
0186     virtual bool bufferFull(XMLBuffer& toSend)
0187     {
0188         sendCharData(toSend);
0189         return true;
0190     }
0191 
0192     virtual Grammar::GrammarType getCurrentGrammarType() const;
0193 
0194     // -----------------------------------------------------------------------
0195     //  Public pure virtual methods
0196     // -----------------------------------------------------------------------
0197     virtual const XMLCh* getName() const = 0;
0198     virtual NameIdPool<DTDEntityDecl>* getEntityDeclPool() = 0;
0199     virtual const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const = 0;
0200     virtual void scanDocument
0201     (
0202         const   InputSource&    src
0203     ) = 0;
0204     virtual bool scanNext(XMLPScanToken& toFill) = 0;
0205     virtual Grammar* loadGrammar
0206     (
0207         const   InputSource&    src
0208         , const short           grammarType
0209         , const bool            toCache = false
0210     ) = 0;
0211 
0212     virtual void resetCachedGrammar ();
0213 
0214     // -----------------------------------------------------------------------
0215     //  Getter methods
0216     // -----------------------------------------------------------------------
0217     const XMLDocumentHandler* getDocHandler() const;
0218     XMLDocumentHandler* getDocHandler();
0219     const DocTypeHandler* getDocTypeHandler() const;
0220     DocTypeHandler* getDocTypeHandler();
0221     bool getDoNamespaces() const;
0222     ValSchemes getValidationScheme() const;
0223     bool getDoSchema() const;
0224     bool getValidationSchemaFullChecking() const;
0225     bool getIdentityConstraintChecking() const;
0226     const XMLEntityHandler* getEntityHandler() const;
0227     XMLEntityHandler* getEntityHandler();
0228     const XMLErrorReporter* getErrorReporter() const;
0229     XMLErrorReporter* getErrorReporter();
0230     const ErrorHandler* getErrorHandler() const;
0231     ErrorHandler* getErrorHandler();
0232     const PSVIHandler* getPSVIHandler() const;
0233     PSVIHandler* getPSVIHandler();
0234     bool getExitOnFirstFatal() const;
0235     bool getValidationConstraintFatal() const;
0236     RefHashTableOf<XMLRefInfo>* getIDRefList();
0237     const RefHashTableOf<XMLRefInfo>* getIDRefList() const;
0238 
0239     ValidationContext*   getValidationContext();
0240 
0241     bool getInException() const;
0242     /*bool getLastExtLocation
0243     (
0244                 XMLCh* const    sysIdToFill
0245         , const unsigned int    maxSysIdChars
0246         ,       XMLCh* const    pubIdToFill
0247         , const unsigned int    maxPubIdChars
0248         ,       XMLSSize_t&     lineToFill
0249         ,       XMLSSize_t&     colToFill
0250     ) const;*/
0251     const Locator* getLocator() const;
0252     const ReaderMgr* getReaderMgr() const;
0253     XMLFilePos getSrcOffset() const;
0254     bool getStandalone() const;
0255     const XMLValidator* getValidator() const;
0256     XMLValidator* getValidator();
0257     int getErrorCount();
0258     const XMLStringPool* getURIStringPool() const;
0259     XMLStringPool* getURIStringPool();
0260     bool getHasNoDTD() const;
0261     XMLCh* getExternalSchemaLocation() const;
0262     XMLCh* getExternalNoNamespaceSchemaLocation() const;
0263     SecurityManager* getSecurityManager() const;
0264     bool getDisallowDTD() const;
0265     bool getLoadExternalDTD() const;
0266     bool getLoadSchema() const;
0267     bool getNormalizeData() const;
0268     bool isCachingGrammarFromParse() const;
0269     bool isUsingCachedGrammarInParse() const;
0270     bool getCalculateSrcOfs() const;
0271     Grammar* getRootGrammar() const;
0272     XMLReader::XMLVersion getXMLVersion() const;
0273     MemoryManager* getMemoryManager() const;
0274     ValueVectorOf<PrefMapElem*>* getNamespaceContext() const;
0275     unsigned int getPrefixId(const XMLCh* const prefix) const;
0276     const XMLCh* getPrefixForId(unsigned int prefId) const;
0277 
0278     // Return is a reference so that we can return it as void* from
0279     // getProperty.
0280     //
0281     const XMLSize_t& getLowWaterMark() const;
0282 
0283     bool getGenerateSyntheticAnnotations() const;
0284     bool getValidateAnnotations() const;
0285     bool getIgnoreCachedDTD() const;
0286     bool getIgnoreAnnotations() const;
0287     bool getDisableDefaultEntityResolution() const;
0288     bool getSkipDTDValidation() const;
0289     bool getHandleMultipleImports() const;
0290 
0291     // -----------------------------------------------------------------------
0292     //  Getter methods
0293     // -----------------------------------------------------------------------
0294     /**
0295       * When an attribute name has no prefix, unlike elements, it is not mapped
0296       * to the global namespace. So, in order to have something to map it to
0297       * for practical purposes, a id for an empty URL is created and used for
0298       * such names.
0299       *
0300       * @return The URL pool id of the URL for an empty URL "".
0301       */
0302     unsigned int getEmptyNamespaceId() const;
0303 
0304     /**
0305       * When a prefix is found that has not been mapped, an error is issued.
0306       * However, if the parser has been instructed not to stop on the first
0307       * fatal error, it needs to be able to continue. To do so, it will map
0308       * that prefix tot his magic unknown namespace id.
0309       *
0310       * @return The URL pool id of the URL for the unknown prefix
0311       *         namespace.
0312       */
0313     unsigned int getUnknownNamespaceId() const;
0314 
0315     /**
0316       * The prefix 'xml' is a magic prefix, defined by the XML spec and
0317       * requiring no prior definition. This method returns the id for the
0318       * intrinsically defined URL for this prefix.
0319       *
0320       * @return The URL pool id of the URL for the 'xml' prefix.
0321       */
0322     unsigned int getXMLNamespaceId() const;
0323 
0324     /**
0325       * The prefix 'xmlns' is a magic prefix, defined by the namespace spec
0326       * and requiring no prior definition. This method returns the id for the
0327       * intrinsically defined URL for this prefix.
0328       *
0329       * @return The URL pool id of the URL for the 'xmlns' prefix.
0330       */
0331     unsigned int getXMLNSNamespaceId() const;
0332 
0333     /**
0334       * This method find the passed URI id in its URI pool and
0335       * copy the text of that URI into the passed buffer.
0336       */
0337     bool getURIText
0338     (
0339         const   unsigned int    uriId
0340         ,       XMLBuffer&      uriBufToFill
0341     )   const;
0342 
0343     const XMLCh* getURIText(const   unsigned int    uriId) const;
0344 
0345     /* tell if the validator comes from user */
0346     bool isValidatorFromUser();
0347 
0348     /* tell if standard URI are forced */
0349     bool getStandardUriConformant() const;
0350 
0351     // -----------------------------------------------------------------------
0352     //  Setter methods
0353     // -----------------------------------------------------------------------
0354     void addGlobalPrefix(const XMLCh* const prefix, const unsigned int uriId);
0355     void setDocHandler(XMLDocumentHandler* const docHandler);
0356     void setDocTypeHandler(DocTypeHandler* const docTypeHandler);
0357     void setDoNamespaces(const bool doNamespaces);
0358     void setEntityHandler(XMLEntityHandler* const docTypeHandler);
0359     void setErrorReporter(XMLErrorReporter* const errHandler);
0360     void setErrorHandler(ErrorHandler* const handler);
0361     void setPSVIHandler(PSVIHandler* const handler);
0362     void setURIStringPool(XMLStringPool* const stringPool);
0363     void setExitOnFirstFatal(const bool newValue);
0364     void setValidationConstraintFatal(const bool newValue);
0365     void setValidationScheme(const ValSchemes newScheme);
0366     void setValidator(XMLValidator* const valToAdopt);
0367     void setDoSchema(const bool doSchema);
0368     void setValidationSchemaFullChecking(const bool schemaFullChecking);
0369     void setIdentityConstraintChecking(const bool identityConstraintChecking);
0370     void setHasNoDTD(const bool hasNoDTD);
0371     void cacheGrammarFromParse(const bool newValue);
0372     void useCachedGrammarInParse(const bool newValue);
0373     void setRootElemName(XMLCh* rootElemName);
0374     void setExternalSchemaLocation(const XMLCh* const schemaLocation);
0375     void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
0376     void setExternalSchemaLocation(const char* const schemaLocation);
0377     void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
0378     void setSecurityManager(SecurityManager* const securityManager);
0379     void setDisallowDTD(const bool disallowDTD);
0380     void setLoadExternalDTD(const bool loadDTD);
0381     void setLoadSchema(const bool loadSchema);
0382     void setNormalizeData(const bool normalizeData);
0383     void setCalculateSrcOfs(const bool newValue);
0384     void setParseSettings(XMLScanner* const refScanner);
0385     void setStandardUriConformant(const bool newValue);
0386     void setInputBufferSize(const XMLSize_t bufferSize);
0387     void setLowWaterMark(XMLSize_t newValue);
0388 
0389     void setGenerateSyntheticAnnotations(const bool newValue);
0390     void setValidateAnnotations(const bool newValue);
0391     void setIgnoredCachedDTD(const bool newValue);
0392     void setIgnoreAnnotations(const bool newValue);
0393     void setDisableDefaultEntityResolution(const bool newValue);
0394     void setSkipDTDValidation(const bool newValue);
0395     void setHandleMultipleImports(const bool newValue);
0396 
0397     // -----------------------------------------------------------------------
0398     //  Mutator methods
0399     // -----------------------------------------------------------------------
0400     void incrementErrorCount(void);         // For use by XMLValidator
0401 
0402     // -----------------------------------------------------------------------
0403     //  Document scanning methods
0404     //
0405     //  scanDocument() does the entire source document. scanFirst(),
0406     //  scanNext(), and scanReset() support a progressive parse.
0407     // -----------------------------------------------------------------------
0408     void scanDocument
0409     (
0410         const   XMLCh* const    systemId
0411     );
0412     void scanDocument
0413     (
0414         const   char* const     systemId
0415     );
0416 
0417     bool scanFirst
0418     (
0419         const   InputSource&    src
0420         ,       XMLPScanToken&  toFill
0421     );
0422     bool scanFirst
0423     (
0424         const   XMLCh* const    systemId
0425         ,       XMLPScanToken&  toFill
0426     );
0427     bool scanFirst
0428     (
0429         const   char* const     systemId
0430         ,       XMLPScanToken&  toFill
0431     );
0432 
0433     void scanReset(XMLPScanToken& toFill);
0434 
0435     bool checkXMLDecl(bool startWithAngle);
0436 
0437     // -----------------------------------------------------------------------
0438     //  Grammar preparsing methods
0439     // -----------------------------------------------------------------------
0440     Grammar* loadGrammar
0441     (
0442         const   XMLCh* const    systemId
0443         , const short           grammarType
0444         , const bool            toCache = false
0445     );
0446     Grammar* loadGrammar
0447     (
0448         const   char* const     systemId
0449         , const short           grammarType
0450         , const bool            toCache = false
0451     );
0452 
0453     // -----------------------------------------------------------------------
0454     //  Helper methods
0455     // -----------------------------------------------------------------------
0456     unsigned int resolveQName
0457     (
0458         const   XMLCh* const        qName
0459         ,       XMLBuffer&          prefixBufToFill
0460         , const ElemStack::MapModes mode
0461         ,       int&                prefixColonPos
0462     );
0463 
0464 protected:
0465     // -----------------------------------------------------------------------
0466     //  Protected pure virtual methods
0467     // -----------------------------------------------------------------------
0468     virtual void scanCDSection() = 0;
0469     virtual void scanCharData(XMLBuffer& toToUse) = 0;
0470     virtual EntityExpRes scanEntityRef
0471     (
0472         const   bool    inAttVal
0473         ,       XMLCh&  firstCh
0474         ,       XMLCh&  secondCh
0475         ,       bool&   escaped
0476     ) = 0;
0477     virtual void scanDocTypeDecl() = 0;
0478     virtual void scanReset(const InputSource& src) = 0;
0479     virtual void sendCharData(XMLBuffer& toSend) = 0;
0480 
0481     //return owned by the caller
0482     virtual InputSource* resolveSystemId(const XMLCh* const /*sysId*/
0483                                         ,const XMLCh* const /*pubId*/) {return 0;};
0484 
0485     // -----------------------------------------------------------------------
0486     //  Protected scanning methods
0487     // -----------------------------------------------------------------------
0488     bool scanCharRef(XMLCh& toFill, XMLCh& second);
0489     void scanComment();
0490     bool scanEq(bool inDecl = false);
0491     void scanMiscellaneous();
0492     void scanPI();
0493     void scanProlog();
0494     void scanXMLDecl(const DeclTypes type);
0495 
0496     // -----------------------------------------------------------------------
0497     //  Private helper methods
0498     // -----------------------------------------------------------------------
0499     void checkInternalDTD(bool hasExtSubset, const XMLCh* const sysId, const XMLCh* const pubId);
0500     void checkIDRefs();
0501     bool isLegalToken(const XMLPScanToken& toCheck);
0502     XMLTokens senseNextToken(XMLSize_t& orgReader);
0503     void initValidator(XMLValidator* theValidator);
0504     inline void resetValidationContext();
0505     unsigned int *getNewUIntPtr();
0506     void resetUIntPool();
0507     void recreateUIntPool();
0508     unsigned int resolvePrefix
0509     (
0510         const   XMLCh* const        prefix
0511         , const ElemStack::MapModes mode
0512     );
0513     unsigned int resolveQNameWithColon
0514     (
0515         const   XMLCh* const        qName
0516         ,       XMLBuffer&          prefixBufToFill
0517         , const ElemStack::MapModes mode
0518         , const int                 prefixColonPos
0519     );
0520 
0521     inline
0522     void setAttrDupChkRegistry
0523          (
0524             const XMLSize_t    &attrNumber
0525           ,       bool         &toUseHashTable
0526          );
0527 
0528     // -----------------------------------------------------------------------
0529     //  Data members
0530     //
0531     //  fBufferSize
0532     //      Maximum input buffer size
0533     //
0534     //  fLowWaterMark
0535     //      The low water mark for the raw byte buffer.
0536     //
0537     //  fAttrList
0538     //      Every time we get a new element start tag, we have to pass to
0539     //      the document handler the attributes found. To make it more
0540     //      efficient we keep this ref vector of XMLAttr objects around. We
0541     //      just reuse it over and over, allowing it to grow to meet the
0542     //      peak need.
0543     //
0544     //  fBufMgr
0545     //      This is a manager for temporary buffers used during scanning.
0546     //      For efficiency we must use a set of static buffers, but we have
0547     //      to insure that they are not incorrectly reused. So this manager
0548     //      provides the smarts to hand out buffers as required.
0549     //
0550     //  fDocHandler
0551     //      The client code's document handler. If zero, then no document
0552     //      handler callouts are done. We don't adopt it.
0553     //
0554     //  fDocTypeHandler
0555     //      The client code's document type handler (used by DTD Validator).
0556     //
0557     //  fDoNamespaces
0558     //      This flag indicates whether the client code wants us to do
0559     //      namespaces or not. If the installed validator indicates that it
0560     //      has to do namespaces, then this is ignored.
0561     //
0562     //  fEntityHandler
0563     //      The client code's entity handler. If zero, then no entity handler
0564     //      callouts are done. We don't adopt it.
0565     //
0566     //  fErrorReporter
0567     //      The client code's error reporter. If zero, then no error reporter
0568     //      callouts are done. We don't adopt it.
0569     //
0570     //  fErrorHandler
0571     //      The client code's error handler.  Need to store this info for
0572     //      Schema parse error handling.
0573     //
0574     //  fPSVIHandler
0575     //      The client code's PSVI handler.
0576     //
0577     //  fExitOnFirstFatal
0578     //      This indicates whether we bail out on the first fatal XML error
0579     //      or not. It defaults to true, which is the strict XML way, but it
0580     //      can be changed.
0581     //
0582     //  fValidationConstraintFatal
0583     //      This indicates whether we treat validation constraint errors as
0584     //      fatal errors or not. It defaults to false, but it can be changed.
0585     //
0586     //  fIDRefList
0587     //      This is a list of XMLRefInfo objects. This member lets us do all
0588     //      needed ID-IDREF balancing checks.
0589     //
0590     //  fInException
0591     //      To avoid a circular freakout when we catch an exception and emit
0592     //      it, which would normally throw again if the 'fail on first error'
0593     //      flag is one.
0594     //
0595     //  fReaderMgr
0596     //      This is the reader manager, from which we get characters. It
0597     //      manages the reader stack for us, and provides a lot of convenience
0598     //      methods to do specialized checking for chars, sequences of chars,
0599     //      skipping chars, etc...
0600     //
0601     //  fScannerId
0602     //  fSequenceId
0603     //      These are used for progressive parsing, to make sure that the
0604     //      client code does the right thing at the right time.
0605     //
0606     //  fStandalone
0607     //      Indicates whether the document is standalone or not. Defaults to
0608     //      no, but can be overridden in the XMLDecl.
0609     //
0610     //  fHasNoDTD
0611     //      Indicates the document has no DTD or has only an internal DTD subset
0612     //      which contains no parameter entity references.
0613     //
0614     //  fValidate
0615     //      Indicates whether any validation should be done. This is defined
0616     //      by the existence of a Grammar together with fValScheme.
0617     //
0618     //  fValidator
0619     //      The installed validator. We look at them via the abstract
0620     //      validator interface, and don't know what it actual is.
0621     //      Either point to user's installed validator, or fDTDValidator
0622     //      or fSchemaValidator.
0623     //
0624     //  fValidatorFromUser
0625     //      This flag indicates whether the validator was installed from
0626     //      user.  If false, then the validator was created by the Scanner.
0627     //
0628     //  fValScheme
0629     //      This is the currently set validation scheme. It defaults to
0630     //      'never', but can be set by the client.
0631     //
0632     //  fErrorCount
0633     //      The number of errors we've encountered.
0634     //
0635     //  fDoSchema
0636     //      This flag indicates whether the client code wants Schema to
0637     //      be processed or not.
0638     //
0639     //  fSchemaFullChecking
0640     //      This flag indicates whether the client code wants full Schema
0641     //      constraint checking.
0642     //
0643     //  fIdentityConstraintChecking
0644     //      This flag indicates whether the client code wants Identity
0645     //      Constraint checking, defaulted to true to maintain backward
0646     //      compatibility (to minimize supprise)
0647     //
0648     //  fAttName
0649     //  fAttValue
0650     //  fCDataBuf
0651     //  fNameBuf
0652     //  fQNameBuf
0653     //  fPrefixBuf
0654     //      For the most part, buffers are obtained from the fBufMgr object
0655     //      on the fly. However, for the start tag scan, we have a set of
0656     //      fixed buffers for performance reasons. These are used a lot and
0657     //      there are a number of them, so asking the buffer manager each
0658     //      time for new buffers is a bit too much overhead.
0659     //
0660     //  fEmptyNamespaceId
0661     //      This is the id of the empty namespace URI. This is a special one
0662     //      because of the xmlns="" type of deal. We have to quickly sense
0663     //      that its the empty namespace.
0664     //
0665     //  fUnknownNamespaceId
0666     //      This is the id of the namespace URI which is assigned to the
0667     //      global namespace. Its for debug purposes only, since there is no
0668     //      real global namespace URI. Its set by the derived class.
0669     //
0670     //  fXMLNamespaceId
0671     //  fXMLNSNamespaceId
0672     //      These are the ids of the namespace URIs which are assigned to the
0673     //      'xml' and 'xmlns' special prefixes. The former is officially
0674     //      defined but the latter is not, so we just provide one for debug
0675     //      purposes.
0676     //
0677     //  fSchemaNamespaceId
0678     //      This is the id of the schema namespace URI.
0679     //
0680     //  fGrammarResolver
0681     //      Grammar Pool that stores all the grammars. Key is namespace for
0682     //      schema and system id for external DTD. When caching a grammar, if
0683     //      a grammar is already in the pool, it will be replaced with the
0684     //      new parsed one.
0685     //
0686     //  fGrammar
0687     //      Current Grammar used by the Scanner and Validator
0688     //
0689     //  fRootGrammar
0690     //      The grammar where the root element is declared.
0691     //
0692     //  fGrammarType
0693     //      Current Grammar Type.  Store this value instead of calling getGrammarType
0694     //      all the time for faster performance.
0695     //
0696     //  fURIStringPool
0697     //      This is a pool for URIs with unique ids assigned. We use a standard
0698     //      string pool class.  This pool is going to be shared by all Grammar.
0699     //      Use only if namespace is turned on.
0700     //
0701     //  fRootElemName
0702     //      No matter we are using DTD or Schema Grammar, if a DOCTYPE exists,
0703     //      we need to verify the root element name.  So store the rootElement
0704     //      that is used in the DOCTYPE in the Scanner instead of in the DTDGrammar
0705     //      where it used to
0706     //
0707     //  fExternalSchemaLocation
0708     //      The list of Namespace/SchemaLocation that was specified externally
0709     //      using setExternalSchemaLocation.
0710     //
0711     //  fExternalNoNamespaceSchemaLocation
0712     //      The no target namespace XML Schema Location that was specified
0713     //      externally using setExternalNoNamespaceSchemaLocation.
0714     //
0715     //  fSecurityManager
0716     //      The SecurityManager instance; as and when set by the application.
0717     //
0718     //  fEntityExpansionLimit
0719     //      The number of entity expansions to be permitted while processing this document
0720     //      Only meaningful when fSecurityManager != 0
0721     //
0722     //  fEntityExpansionCount
0723     //      The number of general entities expanded so far in this document.
0724     //      Only meaningful when fSecurityManager != null
0725     //
0726     //  fDisallowDTD
0727     //      This flag indicates whether the presence of a DTD should be fatal
0728     //
0729     //  fLoadExternalDTD
0730     //      This flag indicates whether the external DTD be loaded or not
0731     //
0732     //  fLoadSchema
0733     //      This flag indicates whether the parser should attempt to load
0734     //      schemas if they cannot be found in the grammar pool.
0735     //
0736     //  fNormalizeData
0737     //      This flag indicates whether the parser should perform datatype
0738     //      normalization that is defined in the schema.
0739     //
0740     //  fCalculateSrcOfs
0741     //      This flag indicates the parser should calculate the source offset.
0742     //      Turning this on may impact performance.
0743     //
0744     //  fStandardUriConformant
0745     //      This flag controls whether we force conformant URI
0746     //
0747     //  fXMLVersion
0748     //      Enum to indicate if the main doc is XML 1.1 or XML 1.0 conformant
0749     //  fUIntPool
0750     //      pool of unsigned integers to help with duplicate attribute
0751     //      detection and filling in default/fixed attributes
0752     //  fUIntPoolRow
0753     //      current row in fUIntPool
0754     //  fUIntPoolCol
0755     //      current column in row
0756     //  fUIntPoolRowTotal
0757     //      total number of rows in table
0758     //
0759     //  fMemoryManager
0760     //      Pluggable memory manager for dynamic allocation/deallocation.
0761     //
0762     // -----------------------------------------------------------------------
0763     XMLSize_t                   fBufferSize;
0764     XMLSize_t                   fLowWaterMark;
0765     bool                        fStandardUriConformant;
0766     bool                        fCalculateSrcOfs;
0767     bool                        fDoNamespaces;
0768     bool                        fExitOnFirstFatal;
0769     bool                        fValidationConstraintFatal;
0770     bool                        fInException;
0771     bool                        fStandalone;
0772     bool                        fHasNoDTD;
0773     bool                        fValidate;
0774     bool                        fValidatorFromUser;
0775     bool                        fDoSchema;
0776     bool                        fSchemaFullChecking;
0777     bool                        fIdentityConstraintChecking;
0778     bool                        fToCacheGrammar;
0779     bool                        fUseCachedGrammar;
0780     bool                        fDisallowDTD;
0781     bool                        fLoadExternalDTD;
0782     bool                        fLoadSchema;
0783     bool                        fNormalizeData;
0784     bool                        fGenerateSyntheticAnnotations;
0785     bool                        fValidateAnnotations;
0786     bool                        fIgnoreCachedDTD;
0787     bool                        fIgnoreAnnotations;
0788     bool                        fDisableDefaultEntityResolution;
0789     bool                        fSkipDTDValidation;
0790     bool                        fHandleMultipleImports;
0791     int                         fErrorCount;
0792     XMLSize_t                   fEntityExpansionLimit;
0793     XMLSize_t                   fEntityExpansionCount;
0794     unsigned int                fEmptyNamespaceId;
0795     unsigned int                fUnknownNamespaceId;
0796     unsigned int                fXMLNamespaceId;
0797     unsigned int                fXMLNSNamespaceId;
0798     unsigned int                fSchemaNamespaceId;
0799     unsigned int **             fUIntPool;
0800     unsigned int                fUIntPoolRow;
0801     unsigned int                fUIntPoolCol;
0802     unsigned int                fUIntPoolRowTotal;
0803     XMLUInt32                   fScannerId;
0804     XMLUInt32                   fSequenceId;
0805     RefVectorOf<XMLAttr>*       fAttrList;
0806     RefHash2KeysTableOf<XMLAttr>*  fAttrDupChkRegistry;
0807     XMLDocumentHandler*         fDocHandler;
0808     DocTypeHandler*             fDocTypeHandler;
0809     XMLEntityHandler*           fEntityHandler;
0810     XMLErrorReporter*           fErrorReporter;
0811     ErrorHandler*               fErrorHandler;
0812     PSVIHandler*                fPSVIHandler;
0813     ValidationContext           *fValidationContext;
0814     bool                        fEntityDeclPoolRetrieved;
0815     ReaderMgr                   fReaderMgr;
0816     XMLValidator*               fValidator;
0817     ValSchemes                  fValScheme;
0818     GrammarResolver* const      fGrammarResolver;
0819     MemoryManager* const        fGrammarPoolMemoryManager;
0820     Grammar*                    fGrammar;
0821     Grammar*                    fRootGrammar;
0822     XMLStringPool*              fURIStringPool;
0823     XMLCh*                      fRootElemName;
0824     XMLCh*                      fExternalSchemaLocation;
0825     XMLCh*                      fExternalNoNamespaceSchemaLocation;
0826     SecurityManager*            fSecurityManager;
0827     XMLReader::XMLVersion       fXMLVersion;
0828     MemoryManager*              fMemoryManager;
0829     XMLBufferMgr                fBufMgr;
0830     XMLBuffer                   fAttNameBuf;
0831     XMLBuffer                   fAttValueBuf;
0832     XMLBuffer                   fCDataBuf;
0833     XMLBuffer                   fQNameBuf;
0834     XMLBuffer                   fPrefixBuf;
0835     XMLBuffer                   fURIBuf;
0836     XMLBuffer                   fWSNormalizeBuf;
0837     ElemStack                   fElemStack;
0838 
0839 
0840 private :
0841     // -----------------------------------------------------------------------
0842     //  Unimplemented constructors and operators
0843     // -----------------------------------------------------------------------
0844     XMLScanner();
0845     XMLScanner(const XMLScanner&);
0846     XMLScanner& operator=(const XMLScanner&);
0847 
0848     // -----------------------------------------------------------------------
0849     //  Private helper methods
0850     // -----------------------------------------------------------------------
0851     void commonInit();
0852     void cleanUp();
0853 
0854     // -----------------------------------------------------------------------
0855     //  Private scanning methods
0856     // -----------------------------------------------------------------------
0857     bool getQuotedString(XMLBuffer& toFill);
0858     XMLSize_t scanUpToWSOr
0859     (
0860                 XMLBuffer&  toFill
0861         , const XMLCh       chEndChar
0862     );
0863 };
0864 
0865 // ---------------------------------------------------------------------------
0866 //  XMLScanner: Getter methods
0867 // ---------------------------------------------------------------------------
0868 inline const XMLDocumentHandler* XMLScanner::getDocHandler() const
0869 {
0870     return fDocHandler;
0871 }
0872 
0873 inline XMLDocumentHandler* XMLScanner::getDocHandler()
0874 {
0875     return fDocHandler;
0876 }
0877 
0878 inline const DocTypeHandler* XMLScanner::getDocTypeHandler() const
0879 {
0880     return fDocTypeHandler;
0881 }
0882 
0883 inline DocTypeHandler* XMLScanner::getDocTypeHandler()
0884 {
0885     return fDocTypeHandler;
0886 }
0887 
0888 inline bool XMLScanner::getDoNamespaces() const
0889 {
0890     return fDoNamespaces;
0891 }
0892 
0893 inline const XMLEntityHandler* XMLScanner::getEntityHandler() const
0894 {
0895     return fEntityHandler;
0896 }
0897 
0898 inline XMLEntityHandler* XMLScanner::getEntityHandler()
0899 {
0900     return fEntityHandler;
0901 }
0902 
0903 inline const XMLErrorReporter* XMLScanner::getErrorReporter() const
0904 {
0905     return fErrorReporter;
0906 }
0907 
0908 inline XMLErrorReporter* XMLScanner::getErrorReporter()
0909 {
0910     return fErrorReporter;
0911 }
0912 
0913 inline const ErrorHandler* XMLScanner::getErrorHandler() const
0914 {
0915     return fErrorHandler;
0916 }
0917 
0918 inline ErrorHandler* XMLScanner::getErrorHandler()
0919 {
0920     return fErrorHandler;
0921 }
0922 
0923 inline const PSVIHandler* XMLScanner::getPSVIHandler() const
0924 {
0925     return fPSVIHandler;
0926 }
0927 
0928 inline PSVIHandler* XMLScanner::getPSVIHandler()
0929 {
0930     return fPSVIHandler;
0931 }
0932 
0933 inline bool XMLScanner::getExitOnFirstFatal() const
0934 {
0935     return fExitOnFirstFatal;
0936 }
0937 
0938 inline bool XMLScanner::getValidationConstraintFatal() const
0939 {
0940     return fValidationConstraintFatal;
0941 }
0942 
0943 inline bool XMLScanner::getInException() const
0944 {
0945     return fInException;
0946 }
0947 
0948 inline RefHashTableOf<XMLRefInfo>* XMLScanner::getIDRefList()
0949 {
0950     return fValidationContext->getIdRefList();
0951 }
0952 
0953 inline const RefHashTableOf<XMLRefInfo>* XMLScanner::getIDRefList() const
0954 {
0955     return fValidationContext->getIdRefList();
0956 }
0957 
0958 inline ValidationContext*  XMLScanner::getValidationContext()
0959 {
0960     if (!fEntityDeclPoolRetrieved)
0961     {
0962         fValidationContext->setEntityDeclPool(getEntityDeclPool());
0963         fEntityDeclPoolRetrieved = true;
0964     }
0965 
0966     return fValidationContext;
0967 }
0968 
0969 inline const Locator* XMLScanner::getLocator() const
0970 {
0971     return &fReaderMgr;
0972 }
0973 
0974 inline const ReaderMgr* XMLScanner::getReaderMgr() const
0975 {
0976     return &fReaderMgr;
0977 }
0978 
0979 inline XMLFilePos XMLScanner::getSrcOffset() const
0980 {
0981     return fReaderMgr.getSrcOffset();
0982 }
0983 
0984 inline bool XMLScanner::getStandalone() const
0985 {
0986     return fStandalone;
0987 }
0988 
0989 inline XMLScanner::ValSchemes XMLScanner::getValidationScheme() const
0990 {
0991     return fValScheme;
0992 }
0993 
0994 inline const XMLValidator* XMLScanner::getValidator() const
0995 {
0996     return fValidator;
0997 }
0998 
0999 inline XMLValidator* XMLScanner::getValidator()
1000 {
1001     return fValidator;
1002 }
1003 
1004 inline bool XMLScanner::getDoSchema() const
1005 {
1006     return fDoSchema;
1007 }
1008 
1009 inline bool XMLScanner::getValidationSchemaFullChecking() const
1010 {
1011     return fSchemaFullChecking;
1012 }
1013 
1014 inline bool XMLScanner::getIdentityConstraintChecking() const
1015 {
1016     return fIdentityConstraintChecking;
1017 }
1018 
1019 inline int XMLScanner::getErrorCount()
1020 {
1021     return fErrorCount;
1022 }
1023 
1024 inline bool XMLScanner::isValidatorFromUser()
1025 {
1026     return fValidatorFromUser;
1027 }
1028 
1029 inline unsigned int XMLScanner::getEmptyNamespaceId() const
1030 {
1031     return fEmptyNamespaceId;
1032 }
1033 
1034 inline unsigned int XMLScanner::getUnknownNamespaceId() const
1035 {
1036     return fUnknownNamespaceId;
1037 }
1038 
1039 inline unsigned int XMLScanner::getXMLNamespaceId() const
1040 {
1041     return fXMLNamespaceId;
1042 }
1043 
1044 inline unsigned int XMLScanner::getXMLNSNamespaceId() const
1045 {
1046     return fXMLNSNamespaceId;
1047 }
1048 
1049 inline const XMLStringPool* XMLScanner::getURIStringPool() const
1050 {
1051     return fURIStringPool;
1052 }
1053 
1054 inline XMLStringPool* XMLScanner::getURIStringPool()
1055 {
1056     return fURIStringPool;
1057 }
1058 
1059 inline bool XMLScanner::getHasNoDTD() const
1060 {
1061     return fHasNoDTD;
1062 }
1063 
1064 inline XMLCh* XMLScanner::getExternalSchemaLocation() const
1065 {
1066     return fExternalSchemaLocation;
1067 }
1068 
1069 inline XMLCh* XMLScanner::getExternalNoNamespaceSchemaLocation() const
1070 {
1071     return fExternalNoNamespaceSchemaLocation;
1072 }
1073 
1074 inline SecurityManager* XMLScanner::getSecurityManager() const
1075 {
1076     return fSecurityManager;
1077 }
1078 
1079 inline bool XMLScanner::getDisallowDTD() const
1080 {
1081     return fDisallowDTD;
1082 }
1083 
1084 inline bool XMLScanner::getLoadExternalDTD() const
1085 {
1086     return fLoadExternalDTD;
1087 }
1088 
1089 inline bool XMLScanner::getLoadSchema() const
1090 {
1091     return fLoadSchema;
1092 }
1093 
1094 inline bool XMLScanner::getNormalizeData() const
1095 {
1096     return fNormalizeData;
1097 }
1098 
1099 inline bool XMLScanner::isCachingGrammarFromParse() const
1100 {
1101     return fToCacheGrammar;
1102 }
1103 
1104 inline bool XMLScanner::isUsingCachedGrammarInParse() const
1105 {
1106     return fUseCachedGrammar;
1107 }
1108 
1109 inline bool XMLScanner::getCalculateSrcOfs() const
1110 {
1111     return fCalculateSrcOfs;
1112 }
1113 
1114 inline Grammar* XMLScanner::getRootGrammar() const
1115 {
1116     return fRootGrammar;
1117 }
1118 
1119 inline bool XMLScanner::getStandardUriConformant() const
1120 {
1121     return fStandardUriConformant;
1122 }
1123 
1124 inline XMLReader::XMLVersion XMLScanner::getXMLVersion() const
1125 {
1126     return fXMLVersion;
1127 }
1128 
1129 inline MemoryManager* XMLScanner::getMemoryManager() const
1130 {
1131     return fMemoryManager;
1132 }
1133 
1134 inline ValueVectorOf<PrefMapElem*>* XMLScanner::getNamespaceContext() const
1135 {
1136     return fElemStack.getNamespaceMap();
1137 }
1138 
1139 inline unsigned int XMLScanner::getPrefixId(const XMLCh* const prefix) const
1140 {
1141     return fElemStack.getPrefixId(prefix);
1142 }
1143 
1144 inline const XMLCh* XMLScanner::getPrefixForId(unsigned int prefId) const
1145 {
1146     return fElemStack.getPrefixForId(prefId);
1147 }
1148 
1149 inline bool XMLScanner::getGenerateSyntheticAnnotations() const
1150 {
1151     return fGenerateSyntheticAnnotations;
1152 }
1153 
1154 inline bool XMLScanner::getValidateAnnotations() const
1155 {
1156     return fValidateAnnotations;
1157 }
1158 
1159 inline const XMLSize_t& XMLScanner::getLowWaterMark() const
1160 {
1161     return fLowWaterMark;
1162 }
1163 
1164 inline bool XMLScanner::getIgnoreCachedDTD() const
1165 {
1166     return fIgnoreCachedDTD;
1167 }
1168 
1169 inline bool XMLScanner::getIgnoreAnnotations() const
1170 {
1171     return fIgnoreAnnotations;
1172 }
1173 
1174 inline bool XMLScanner::getDisableDefaultEntityResolution() const
1175 {
1176     return fDisableDefaultEntityResolution;
1177 }
1178 
1179 inline bool XMLScanner::getSkipDTDValidation() const
1180 {
1181     return fSkipDTDValidation;
1182 }
1183 
1184 inline bool XMLScanner::getHandleMultipleImports() const
1185 {
1186     return fHandleMultipleImports;
1187 }
1188 
1189 // ---------------------------------------------------------------------------
1190 //  XMLScanner: Setter methods
1191 // ---------------------------------------------------------------------------
1192 inline void XMLScanner::addGlobalPrefix(const XMLCh* const prefix, const unsigned int uriId)
1193 {
1194     fElemStack.addGlobalPrefix(prefix, uriId);
1195 }
1196 
1197 inline void XMLScanner::setDocHandler(XMLDocumentHandler* const docHandler)
1198 {
1199     fDocHandler = docHandler;
1200 }
1201 
1202 inline void XMLScanner::setDocTypeHandler(DocTypeHandler* const docTypeHandler)
1203 {
1204     fDocTypeHandler = docTypeHandler;
1205 }
1206 
1207 inline void XMLScanner::setErrorHandler(ErrorHandler* const handler)
1208 {
1209     fErrorHandler = handler;
1210 }
1211 
1212 inline void XMLScanner::setPSVIHandler(PSVIHandler* const handler)
1213 {
1214     fPSVIHandler = handler;
1215 }
1216 
1217 inline void XMLScanner::setEntityHandler(XMLEntityHandler* const entityHandler)
1218 {
1219     fEntityHandler = entityHandler;
1220     fReaderMgr.setEntityHandler(entityHandler);
1221 }
1222 
1223 inline void XMLScanner::setErrorReporter(XMLErrorReporter* const errHandler)
1224 {
1225     fErrorReporter = errHandler;
1226 }
1227 
1228 inline void XMLScanner::setExitOnFirstFatal(const bool newValue)
1229 {
1230     fExitOnFirstFatal = newValue;
1231 }
1232 
1233 
1234 inline void XMLScanner::setValidationConstraintFatal(const bool newValue)
1235 {
1236     fValidationConstraintFatal = newValue;
1237 }
1238 
1239 inline void XMLScanner::setValidationScheme(const ValSchemes newScheme)
1240 {
1241     fValScheme = newScheme;
1242 
1243     // validation flag for Val_Auto is set to false by default,
1244     //   and will be turned to true if a grammar is seen
1245     if (fValScheme == Val_Always)
1246         fValidate = true;
1247     else
1248         fValidate = false;
1249 }
1250 
1251 inline void XMLScanner::setDoSchema(const bool doSchema)
1252 {
1253     fDoSchema = doSchema;
1254 }
1255 
1256 inline void XMLScanner::setDoNamespaces(const bool doNamespaces)
1257 {
1258     fDoNamespaces = doNamespaces;
1259 }
1260 
1261 inline void XMLScanner::setValidationSchemaFullChecking(const bool schemaFullChecking)
1262 {
1263     fSchemaFullChecking = schemaFullChecking;
1264 }
1265 
1266 inline void XMLScanner::setIdentityConstraintChecking(const bool identityConstraintChecking)
1267 {
1268     fIdentityConstraintChecking = identityConstraintChecking;
1269 }
1270 
1271 inline void XMLScanner::setHasNoDTD(const bool hasNoDTD)
1272 {
1273     fHasNoDTD = hasNoDTD;
1274 }
1275 
1276 inline void XMLScanner::setRootElemName(XMLCh* rootElemName)
1277 {
1278     fMemoryManager->deallocate(fRootElemName);//delete [] fRootElemName;
1279     fRootElemName = XMLString::replicate(rootElemName, fMemoryManager);
1280 }
1281 
1282 inline void XMLScanner::setExternalSchemaLocation(const XMLCh* const schemaLocation)
1283 {
1284     fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation;
1285     fExternalSchemaLocation = XMLString::replicate(schemaLocation, fMemoryManager);
1286 }
1287 
1288 inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation)
1289 {
1290     fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);//delete [] fExternalNoNamespaceSchemaLocation;
1291     fExternalNoNamespaceSchemaLocation = XMLString::replicate(noNamespaceSchemaLocation, fMemoryManager);
1292 }
1293 
1294 inline void XMLScanner::setExternalSchemaLocation(const char* const schemaLocation)
1295 {
1296     fMemoryManager->deallocate(fExternalSchemaLocation);//delete [] fExternalSchemaLocation;
1297     fExternalSchemaLocation = XMLString::transcode(schemaLocation, fMemoryManager);
1298 }
1299 
1300 inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation)
1301 {
1302     fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);//delete [] fExternalNoNamespaceSchemaLocation;
1303     fExternalNoNamespaceSchemaLocation = XMLString::transcode(noNamespaceSchemaLocation, fMemoryManager);
1304 }
1305 
1306 inline void XMLScanner::setSecurityManager(SecurityManager* const securityManager)
1307 {
1308     fSecurityManager = securityManager;
1309     if(securityManager != 0)
1310     {
1311         fEntityExpansionLimit = securityManager->getEntityExpansionLimit();
1312         fEntityExpansionCount = 0;
1313     }
1314 }
1315 
1316 inline void XMLScanner::setDisallowDTD(const bool disallowDTD)
1317 {
1318     fDisallowDTD = disallowDTD;
1319 }
1320 
1321 inline void XMLScanner::setLoadExternalDTD(const bool loadDTD)
1322 {
1323     fLoadExternalDTD = loadDTD;
1324 }
1325 
1326 inline void XMLScanner::setLoadSchema(const bool loadSchema)
1327 {
1328     fLoadSchema = loadSchema;
1329 }
1330 
1331 inline void XMLScanner::setNormalizeData(const bool normalizeData)
1332 {
1333     fNormalizeData = normalizeData;
1334 }
1335 
1336 inline void XMLScanner::cacheGrammarFromParse(const bool newValue)
1337 {
1338     fToCacheGrammar = newValue;
1339 }
1340 
1341 inline void XMLScanner::useCachedGrammarInParse(const bool newValue)
1342 {
1343     fUseCachedGrammar = newValue;
1344 }
1345 
1346 inline void XMLScanner::setCalculateSrcOfs(const bool newValue)
1347 {
1348     fCalculateSrcOfs = newValue;
1349 }
1350 
1351 inline void XMLScanner::setStandardUriConformant(const bool newValue)
1352 {
1353     fStandardUriConformant = newValue;
1354     fReaderMgr.setStandardUriConformant(newValue);
1355 }
1356 
1357 inline void XMLScanner::setGenerateSyntheticAnnotations(const bool newValue)
1358 {
1359     fGenerateSyntheticAnnotations = newValue;
1360 }
1361 
1362 inline void XMLScanner::setValidateAnnotations(const bool newValue)
1363 {
1364     fValidateAnnotations = newValue;
1365 }
1366 
1367 inline void XMLScanner::setInputBufferSize(const XMLSize_t bufferSize)
1368 {
1369     fBufferSize = bufferSize;
1370     fCDataBuf.setFullHandler(this, fBufferSize);
1371 }
1372 
1373 inline void XMLScanner::setLowWaterMark(XMLSize_t newValue)
1374 {
1375     fLowWaterMark = newValue;
1376 }
1377 
1378 inline void XMLScanner::setIgnoredCachedDTD(const bool newValue)
1379 {
1380     fIgnoreCachedDTD = newValue;
1381 }
1382 
1383 inline void XMLScanner::setIgnoreAnnotations(const bool newValue)
1384 {
1385     fIgnoreAnnotations = newValue;
1386 }
1387 
1388 inline void XMLScanner::setDisableDefaultEntityResolution(const bool newValue)
1389 {
1390     fDisableDefaultEntityResolution = newValue;
1391 }
1392 
1393 inline void XMLScanner::setSkipDTDValidation(const bool newValue)
1394 {
1395     fSkipDTDValidation = newValue;
1396 }
1397 
1398 inline void XMLScanner::setHandleMultipleImports(const bool newValue)
1399 {
1400     fHandleMultipleImports = newValue;
1401 }
1402 
1403 // ---------------------------------------------------------------------------
1404 //  XMLScanner: Mutator methods
1405 // ---------------------------------------------------------------------------
1406 inline void XMLScanner::incrementErrorCount()
1407 {
1408     ++fErrorCount;
1409 }
1410 
1411 inline void XMLScanner::resetValidationContext()
1412 {
1413     fValidationContext->clearIdRefList();
1414     fValidationContext->setEntityDeclPool(0);
1415     fEntityDeclPoolRetrieved = false;
1416 }
1417 
1418 inline void XMLScanner::setAttrDupChkRegistry(const XMLSize_t    &attrNumber
1419                                             ,       bool         &toUseHashTable)
1420 {
1421    // once the attribute exceed 100, we use hash table to check duplication
1422     if (attrNumber > 100)
1423    {
1424         toUseHashTable = true;
1425 
1426         if (!fAttrDupChkRegistry)
1427         {
1428             fAttrDupChkRegistry = new (fMemoryManager) RefHash2KeysTableOf<XMLAttr>
1429             (
1430               2*attrNumber+1, false, fMemoryManager
1431             );
1432         }
1433         else
1434         {
1435             fAttrDupChkRegistry->removeAll();
1436         }
1437     }
1438 
1439 }
1440 
1441 inline Grammar::GrammarType XMLScanner::getCurrentGrammarType() const
1442 {
1443     return Grammar::UnKnown;
1444 }
1445 
1446 XERCES_CPP_NAMESPACE_END
1447 
1448 #endif