00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 #if !defined(XMLVALIDATOR_HPP)
00151 #define XMLVALIDATOR_HPP
00152
00153 #include <xercesc/framework/XMLAttr.hpp>
00154 #include <xercesc/framework/XMLValidityCodes.hpp>
00155
00156 XERCES_CPP_NAMESPACE_BEGIN
00157
00158 class ReaderMgr;
00159 class XMLBufferMgr;
00160 class XMLElementDecl;
00161 class XMLScanner;
00162 class Grammar;
00163
00164
00180 class XMLValidator : public XMemory
00181 {
00182 public:
00183
00184
00185
00186
00189
00194 virtual ~XMLValidator()
00195 {
00196 }
00198
00199
00200
00201
00202
00203
00206
00226 virtual int checkContent
00227 (
00228 XMLElementDecl* const elemDecl
00229 , QName** const children
00230 , const unsigned int childCount
00231 ) = 0;
00232
00241 virtual void faultInAttr
00242 (
00243 XMLAttr& toFill
00244 , const XMLAttDef& attDef
00245 ) const = 0;
00246
00250 virtual void preContentValidation(bool reuseGrammar,
00251 bool validateDefAttr = false) = 0;
00252
00260 virtual void postParseValidation() = 0;
00261
00267 virtual void reset() = 0;
00268
00275 virtual bool requiresNamespaces() const = 0;
00276
00287 virtual void validateAttrValue
00288 (
00289 const XMLAttDef* attDef
00290 , const XMLCh* const attrValue
00291 , bool preValidation = false
00292 , const XMLElementDecl* elemDecl = 0
00293 ) = 0;
00294
00302 virtual void validateElement
00303 (
00304 const XMLElementDecl* elemDef
00305 ) = 0;
00306
00310 virtual Grammar* getGrammar() const =0;
00311
00315 virtual void setGrammar(Grammar* aGrammar) =0;
00316
00317
00319
00320
00321
00322
00323
00326
00331 virtual bool handlesDTD() const = 0;
00332
00333
00334
00335
00336
00343 virtual bool handlesSchema() const = 0;
00344
00346
00347
00348
00349
00350
00351
00352
00353
00356
00370 void setScannerInfo
00371 (
00372 XMLScanner* const owningScanner
00373 , ReaderMgr* const readerMgr
00374 , XMLBufferMgr* const bufMgr
00375 );
00376
00386 void setErrorReporter
00387 (
00388 XMLErrorReporter* const errorReporter
00389 );
00390
00392
00393
00394
00395
00396
00397
00400
00419 void emitError(const XMLValid::Codes toEmit);
00420 void emitError
00421 (
00422 const XMLValid::Codes toEmit
00423 , const XMLCh* const text1
00424 , const XMLCh* const text2 = 0
00425 , const XMLCh* const text3 = 0
00426 , const XMLCh* const text4 = 0
00427 );
00428 void emitError
00429 (
00430 const XMLValid::Codes toEmit
00431 , const char* const text1
00432 , const char* const text2 = 0
00433 , const char* const text3 = 0
00434 , const char* const text4 = 0
00435 );
00436
00438
00439
00440
00441
00449 bool checkRootElement
00450 (
00451 const unsigned int
00452 ) { return true;};
00453
00454
00455
00456
00457 static void reinitMsgMutex();
00458
00459 static void reinitMsgLoader();
00460
00461 protected :
00462
00463
00464
00465 XMLValidator
00466 (
00467 XMLErrorReporter* const errReporter = 0
00468 );
00469
00470
00471
00472
00473
00474 const XMLBufferMgr* getBufMgr() const;
00475 XMLBufferMgr* getBufMgr();
00476 const ReaderMgr* getReaderMgr() const;
00477 ReaderMgr* getReaderMgr();
00478 const XMLScanner* getScanner() const;
00479 XMLScanner* getScanner();
00480
00481
00482 private :
00483
00484
00485
00486 XMLValidator(const XMLValidator&);
00487 XMLValidator& operator=(const XMLValidator&);
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497 XMLBufferMgr* fBufMgr;
00498 XMLErrorReporter* fErrorReporter;
00499 ReaderMgr* fReaderMgr;
00500 XMLScanner* fScanner;
00501 };
00502
00503
00504
00505
00506
00507 inline void
00508 XMLValidator::setScannerInfo(XMLScanner* const owningScanner
00509 , ReaderMgr* const readerMgr
00510 , XMLBufferMgr* const bufMgr)
00511 {
00512
00513 fScanner = owningScanner;
00514 fReaderMgr = readerMgr;
00515 fBufMgr = bufMgr;
00516 }
00517
00518 inline void
00519 XMLValidator::setErrorReporter(XMLErrorReporter* const errorReporter)
00520 {
00521 fErrorReporter = errorReporter;
00522 }
00523
00524
00525
00526
00527
00528 inline const XMLBufferMgr* XMLValidator::getBufMgr() const
00529 {
00530 return fBufMgr;
00531 }
00532
00533 inline XMLBufferMgr* XMLValidator::getBufMgr()
00534 {
00535 return fBufMgr;
00536 }
00537
00538 inline const ReaderMgr* XMLValidator::getReaderMgr() const
00539 {
00540 return fReaderMgr;
00541 }
00542
00543 inline ReaderMgr* XMLValidator::getReaderMgr()
00544 {
00545 return fReaderMgr;
00546 }
00547
00548 inline const XMLScanner* XMLValidator::getScanner() const
00549 {
00550 return fScanner;
00551 }
00552
00553 inline XMLScanner* XMLValidator::getScanner()
00554 {
00555 return fScanner;
00556 }
00557
00558 XERCES_CPP_NAMESPACE_END
00559
00560 #endif