File indexing completed on 2025-01-18 10:14:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
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
0067
0068
0069 class XMLPARSER_EXPORT XMLScanner : public XMemory, public XMLBufferFullHandler
0070 {
0071 public :
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
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
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
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
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
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
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
0243
0244
0245
0246
0247
0248
0249
0250
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
0279
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
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302 unsigned int getEmptyNamespaceId() const;
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313 unsigned int getUnknownNamespaceId() const;
0314
0315
0316
0317
0318
0319
0320
0321
0322 unsigned int getXMLNamespaceId() const;
0323
0324
0325
0326
0327
0328
0329
0330
0331 unsigned int getXMLNSNamespaceId() const;
0332
0333
0334
0335
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
0346 bool isValidatorFromUser();
0347
0348
0349 bool getStandardUriConformant() const;
0350
0351
0352
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
0399
0400 void incrementErrorCount(void);
0401
0402
0403
0404
0405
0406
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
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
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
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
0482 virtual InputSource* resolveSystemId(const XMLCh* const
0483 ,const XMLCh* const ) {return 0;};
0484
0485
0486
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
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
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
0760
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
0843
0844 XMLScanner();
0845 XMLScanner(const XMLScanner&);
0846 XMLScanner& operator=(const XMLScanner&);
0847
0848
0849
0850
0851 void commonInit();
0852 void cleanUp();
0853
0854
0855
0856
0857 bool getQuotedString(XMLBuffer& toFill);
0858 XMLSize_t scanUpToWSOr
0859 (
0860 XMLBuffer& toFill
0861 , const XMLCh chEndChar
0862 );
0863 };
0864
0865
0866
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
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
1244
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);
1279 fRootElemName = XMLString::replicate(rootElemName, fMemoryManager);
1280 }
1281
1282 inline void XMLScanner::setExternalSchemaLocation(const XMLCh* const schemaLocation)
1283 {
1284 fMemoryManager->deallocate(fExternalSchemaLocation);
1285 fExternalSchemaLocation = XMLString::replicate(schemaLocation, fMemoryManager);
1286 }
1287
1288 inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation)
1289 {
1290 fMemoryManager->deallocate(fExternalNoNamespaceSchemaLocation);
1291 fExternalNoNamespaceSchemaLocation = XMLString::replicate(noNamespaceSchemaLocation, fMemoryManager);
1292 }
1293
1294 inline void XMLScanner::setExternalSchemaLocation(const char* const schemaLocation)
1295 {
1296 fMemoryManager->deallocate(fExternalSchemaLocation);
1297 fExternalSchemaLocation = XMLString::transcode(schemaLocation, fMemoryManager);
1298 }
1299
1300 inline void XMLScanner::setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation)
1301 {
1302 fMemoryManager->deallocate(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
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
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