File indexing completed on 2025-01-30 10:27:30
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_DTDSCANNER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DTDSCANNER_HPP
0024
0025 #include <xercesc/validators/DTD/DTDGrammar.hpp>
0026 #include <xercesc/validators/DTD/DTDEntityDecl.hpp>
0027
0028 XERCES_CPP_NAMESPACE_BEGIN
0029
0030 class XMLScanner;
0031
0032
0033
0034
0035 class DocTypeHandler;
0036
0037 class VALIDATORS_EXPORT DTDScanner : public XMemory
0038 {
0039 public:
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 enum EntityExpRes
0051 {
0052 EntityExp_Failed
0053 , EntityExp_Pushed
0054 , EntityExp_Returned
0055 };
0056
0057 enum IDTypes
0058 {
0059 IDType_Public
0060 , IDType_External
0061 , IDType_Either
0062 };
0063
0064
0065
0066
0067
0068
0069 DTDScanner
0070 (
0071 DTDGrammar* dtdGrammar
0072 , DocTypeHandler* const docTypeHandler
0073 , MemoryManager* const grammarPoolMemoryManager
0074 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0075 );
0076 virtual ~DTDScanner();
0077
0078
0079
0080
0081 DocTypeHandler* getDocTypeHandler();
0082 const DocTypeHandler* getDocTypeHandler() const;
0083
0084
0085
0086
0087
0088
0089
0090 void setScannerInfo
0091 (
0092 XMLScanner* const owningScanner
0093 , ReaderMgr* const readerMgr
0094 , XMLBufferMgr* const bufMgr
0095 );
0096
0097 void setDocTypeHandler
0098 (
0099 DocTypeHandler* const handlerToSet
0100 );
0101
0102 void scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD);
0103 bool scanInternalSubset();
0104 bool scanId
0105 (
0106 XMLBuffer& pubIdToFill
0107 , XMLBuffer& sysIdToFill
0108 , const IDTypes whatKind
0109 );
0110
0111 private:
0112
0113
0114
0115 DTDScanner(const DTDScanner &);
0116 DTDScanner& operator = (const DTDScanner&);
0117
0118
0119
0120
0121 bool checkForPERef
0122 (
0123 const bool inLiteral
0124 , const bool inMarkup
0125 );
0126 bool expandPERef
0127 (
0128 const bool scanExternal
0129 , const bool inLiteral
0130 , const bool inMarkup
0131 , const bool throwEndOfExt = false
0132 );
0133 bool getQuotedString(XMLBuffer& toFill);
0134 XMLAttDef* scanAttDef(DTDElementDecl& elemDecl, XMLBuffer& bufToUse);
0135 bool scanAttValue
0136 (
0137 const XMLCh* const attrName
0138 , XMLBuffer& toFill
0139 , const XMLAttDef::AttTypes type
0140 );
0141 void scanAttListDecl();
0142 ContentSpecNode* scanChildren
0143 (
0144 const DTDElementDecl& elemDecl
0145 , XMLBuffer& bufToUse
0146 , unsigned int& depth
0147 );
0148 bool scanCharRef(XMLCh& toFill, XMLCh& second);
0149 void scanComment();
0150 bool scanContentSpec(DTDElementDecl& toFill);
0151 void scanDefaultDecl(DTDAttDef& toFill);
0152 void scanElementDecl();
0153 void scanEntityDecl();
0154 bool scanEntityDef();
0155 bool scanEntityLiteral(XMLBuffer& toFill);
0156 bool scanEntityDef(DTDEntityDecl& decl, const bool isPEDecl);
0157 EntityExpRes scanEntityRef(XMLCh& firstCh, XMLCh& secondCh, bool& escaped);
0158 bool scanEnumeration
0159 (
0160 const DTDAttDef& attDef
0161 , XMLBuffer& toFill
0162 , const bool notation
0163 );
0164 bool scanEq();
0165 void scanIgnoredSection();
0166 void scanMarkupDecl(const bool parseTextDecl);
0167 bool scanMixed(DTDElementDecl& toFill);
0168 void scanNotationDecl();
0169 void scanPI();
0170 bool scanPublicLiteral(XMLBuffer& toFill);
0171 bool scanSystemLiteral(XMLBuffer& toFill);
0172 void scanTextDecl();
0173 bool isReadingExternalEntity();
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229 MemoryManager* fMemoryManager;
0230 MemoryManager* fGrammarPoolMemoryManager;
0231 DocTypeHandler* fDocTypeHandler;
0232 DTDAttDef* fDumAttDef;
0233 DTDElementDecl* fDumElemDecl;
0234 DTDEntityDecl* fDumEntityDecl;
0235 bool fInternalSubset;
0236 unsigned int fNextAttrId;
0237 DTDGrammar* fDTDGrammar;
0238 XMLBufferMgr* fBufMgr;
0239 ReaderMgr* fReaderMgr;
0240 XMLScanner* fScanner;
0241 NameIdPool<DTDEntityDecl>* fPEntityDeclPool;
0242 unsigned int fEmptyNamespaceId;
0243 XMLSize_t fDocTypeReaderId;
0244 };
0245
0246
0247
0248
0249
0250 inline DocTypeHandler* DTDScanner::getDocTypeHandler()
0251 {
0252 return fDocTypeHandler;
0253 }
0254
0255 inline const DocTypeHandler* DTDScanner::getDocTypeHandler() const
0256 {
0257 return fDocTypeHandler;
0258 }
0259
0260
0261
0262
0263
0264 inline void DTDScanner::setDocTypeHandler(DocTypeHandler* const handlerToSet)
0265 {
0266 fDocTypeHandler = handlerToSet;
0267 }
0268
0269
0270
0271
0272 inline bool DTDScanner::isReadingExternalEntity() {
0273 return (fDocTypeReaderId != fReaderMgr->getCurrentReaderNum());
0274 }
0275
0276 XERCES_CPP_NAMESPACE_END
0277
0278 #endif