File indexing completed on 2025-01-18 10:14:55
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_IGXMLSCANNER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_IGXMLSCANNER_HPP
0024
0025 #include <xercesc/internal/XMLScanner.hpp>
0026 #include <xercesc/util/KVStringPair.hpp>
0027 #include <xercesc/util/NameIdPool.hpp>
0028 #include <xercesc/util/RefHash2KeysTableOf.hpp>
0029 #include <xercesc/util/RefHash3KeysIdPool.hpp>
0030 #include <xercesc/util/Hash2KeysSetOf.hpp>
0031 #include <xercesc/validators/common/Grammar.hpp>
0032 #include <xercesc/validators/schema/SchemaInfo.hpp>
0033 #include <xercesc/validators/schema/SchemaElementDecl.hpp>
0034
0035 XERCES_CPP_NAMESPACE_BEGIN
0036
0037 class DTDElementDecl;
0038 class DTDGrammar;
0039 class DTDValidator;
0040 class SchemaValidator;
0041 class IdentityConstraintHandler;
0042 class IdentityConstraint;
0043 class ContentLeafNameTypeVector;
0044 class SchemaAttDef;
0045 class XMLContentModel;
0046 class XSModel;
0047 class PSVIAttributeList;
0048 class PSVIElement;
0049
0050
0051
0052 class XMLPARSER_EXPORT IGXMLScanner : public XMLScanner
0053 {
0054 public :
0055
0056
0057
0058 IGXMLScanner
0059 (
0060 XMLValidator* const valToAdopt
0061 , GrammarResolver* const grammarResolver
0062 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0063 );
0064 IGXMLScanner
0065 (
0066 XMLDocumentHandler* const docHandler
0067 , DocTypeHandler* const docTypeHandler
0068 , XMLEntityHandler* const entityHandler
0069 , XMLErrorReporter* const errReporter
0070 , XMLValidator* const valToAdopt
0071 , GrammarResolver* const grammarResolver
0072 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0073 );
0074 virtual ~IGXMLScanner();
0075
0076
0077
0078
0079 virtual const XMLCh* getName() const;
0080 virtual NameIdPool<DTDEntityDecl>* getEntityDeclPool();
0081 virtual const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const;
0082 virtual void scanDocument
0083 (
0084 const InputSource& src
0085 );
0086 virtual bool scanNext(XMLPScanToken& toFill);
0087 virtual Grammar* loadGrammar
0088 (
0089 const InputSource& src
0090 , const short grammarType
0091 , const bool toCache = false
0092 );
0093
0094 virtual void resetCachedGrammar ();
0095 virtual Grammar::GrammarType getCurrentGrammarType() const;
0096
0097 private :
0098
0099
0100
0101 IGXMLScanner();
0102 IGXMLScanner(const IGXMLScanner&);
0103 IGXMLScanner& operator=(const IGXMLScanner&);
0104
0105
0106
0107
0108 virtual void scanCDSection();
0109 virtual void scanCharData(XMLBuffer& toToUse);
0110 virtual EntityExpRes scanEntityRef
0111 (
0112 const bool inAttVal
0113 , XMLCh& firstCh
0114 , XMLCh& secondCh
0115 , bool& escaped
0116 );
0117 virtual void scanDocTypeDecl();
0118 virtual void scanReset(const InputSource& src);
0119 virtual void sendCharData(XMLBuffer& toSend);
0120 virtual InputSource* resolveSystemId(const XMLCh* const sysId
0121 ,const XMLCh* const pubId);
0122
0123
0124
0125
0126 void commonInit();
0127 void cleanUp();
0128
0129 XMLSize_t buildAttList
0130 (
0131 const RefVectorOf<KVStringPair>& providedAttrs
0132 , const XMLSize_t attCount
0133 , XMLElementDecl* elemDecl
0134 , RefVectorOf<XMLAttr>& toFill
0135 );
0136 bool normalizeAttValue
0137 (
0138 const XMLAttDef* const attDef
0139 , const XMLCh* const name
0140 , const XMLCh* const value
0141 , XMLBuffer& toFill
0142 );
0143 bool normalizeAttRawValue
0144 (
0145 const XMLCh* const attrName
0146 , const XMLCh* const value
0147 , XMLBuffer& toFill
0148 );
0149 void updateNSMap
0150 (
0151 const XMLCh* const attrName
0152 , const XMLCh* const attrValue
0153 );
0154 void updateNSMap
0155 (
0156 const XMLCh* const attrName
0157 , const XMLCh* const attrValue
0158 , const int colonPosition
0159 );
0160 void scanRawAttrListforNameSpaces(XMLSize_t attCount);
0161 void parseSchemaLocation(const XMLCh* const schemaLocationStr, bool ignoreLoadSchema = false);
0162 void resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri, bool ignoreLoadSchema = false);
0163 bool switchGrammar(const XMLCh* const newGrammarNameSpace);
0164 bool laxElementValidation(QName* element, ContentLeafNameTypeVector* cv,
0165 const XMLContentModel* const cm,
0166 const XMLSize_t parentElemDepth);
0167 bool anyAttributeValidation(SchemaAttDef* attWildCard,
0168 unsigned int uriId,
0169 bool& skipThisOne,
0170 bool& laxThisOne);
0171 void resizeElemState();
0172 void processSchemaLocation(XMLCh* const schemaLoc);
0173
0174 void resizeRawAttrColonList();
0175
0176
0177
0178
0179 bool basicAttrValueScan
0180 (
0181 const XMLCh* const attrName
0182 , XMLBuffer& toFill
0183 );
0184 XMLSize_t rawAttrScan
0185 (
0186 const XMLCh* const elemName
0187 , RefVectorOf<KVStringPair>& toFill
0188 , bool& isEmpty
0189 );
0190 bool scanAttValue
0191 (
0192 const XMLAttDef* const attDef
0193 , const XMLCh* const attrName
0194 , XMLBuffer& toFill
0195 );
0196 bool scanContent();
0197 void scanEndTag(bool& gotData);
0198 bool scanStartTag(bool& gotData);
0199 bool scanStartTagNS(bool& gotData);
0200
0201
0202
0203
0204 inline bool toCheckIdentityConstraint() const;
0205
0206
0207
0208
0209 Grammar* loadXMLSchemaGrammar(const InputSource& src, const bool toCache = false);
0210 Grammar* loadDTDGrammar(const InputSource& src, const bool toCache = false);
0211
0212
0213
0214
0215 void endElementPSVI(SchemaElementDecl* const elemDecl,
0216 DatatypeValidator* const memberDV);
0217 void resetPSVIElemContext();
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263 bool fSeeXsi;
0264 Grammar::GrammarType fGrammarType;
0265 unsigned int fElemStateSize;
0266 unsigned int* fElemState;
0267 unsigned int* fElemLoopState;
0268 XMLBuffer fContent;
0269 RefVectorOf<KVStringPair>* fRawAttrList;
0270 unsigned int fRawAttrColonListSize;
0271 int* fRawAttrColonList;
0272 DTDValidator* fDTDValidator;
0273 SchemaValidator* fSchemaValidator;
0274 DTDGrammar* fDTDGrammar;
0275 IdentityConstraintHandler* fICHandler;
0276 ValueVectorOf<XMLCh*>* fLocationPairs;
0277 NameIdPool<DTDElementDecl>* fDTDElemNonDeclPool;
0278 RefHash3KeysIdPool<SchemaElementDecl>* fSchemaElemNonDeclPool;
0279 unsigned int fElemCount;
0280 RefHashTableOf<unsigned int, PtrHasher>*fAttDefRegistry;
0281 Hash2KeysSetOf<StringHasher>* fUndeclaredAttrRegistry;
0282 PSVIAttributeList * fPSVIAttrList;
0283 XSModel* fModel;
0284 PSVIElement* fPSVIElement;
0285 ValueStackOf<bool>* fErrorStack;
0286 PSVIElemContext fPSVIElemContext;
0287 RefHash2KeysTableOf<SchemaInfo>* fSchemaInfoList;
0288 RefHash2KeysTableOf<SchemaInfo>* fCachedSchemaInfoList;
0289 };
0290
0291 inline const XMLCh* IGXMLScanner::getName() const
0292 {
0293 return XMLUni::fgIGXMLScanner;
0294 }
0295
0296 inline bool IGXMLScanner::toCheckIdentityConstraint() const
0297 {
0298 return fValidate && fIdentityConstraintChecking && fICHandler;
0299 }
0300
0301 inline Grammar::GrammarType IGXMLScanner::getCurrentGrammarType() const
0302 {
0303 return fGrammarType;
0304 }
0305
0306 XERCES_CPP_NAMESPACE_END
0307
0308 #endif