[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
---|
| 5 | * reserved.
|
---|
| 6 | *
|
---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
---|
| 8 | * modification, are permitted provided that the following conditions
|
---|
| 9 | * are met:
|
---|
| 10 | *
|
---|
| 11 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | *
|
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer in
|
---|
| 16 | * the documentation and/or other materials provided with the
|
---|
| 17 | * distribution.
|
---|
| 18 | *
|
---|
| 19 | * 3. The end-user documentation included with the redistribution,
|
---|
| 20 | * if any, must include the following acknowledgment:
|
---|
| 21 | * "This product includes software developed by the
|
---|
| 22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 25 | *
|
---|
| 26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 27 | * not be used to endorse or promote products derived from this
|
---|
| 28 | * software without prior written permission. For written
|
---|
| 29 | * permission, please contact apache\@apache.org.
|
---|
| 30 | *
|
---|
| 31 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 32 | * nor may "Apache" appear in their name, without prior written
|
---|
| 33 | * permission of the Apache Software Foundation.
|
---|
| 34 | *
|
---|
| 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 46 | * SUCH DAMAGE.
|
---|
| 47 | * ====================================================================
|
---|
| 48 | *
|
---|
| 49 | * This software consists of voluntary contributions made by many
|
---|
| 50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 51 | * originally based on software copyright (c) 1999, International
|
---|
| 52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 53 | * on the Apache Software Foundation, please see
|
---|
| 54 | * <http://www.apache.org/>.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * $Log: XMLValidator.hpp,v $
|
---|
| 59 | * Revision 1.9 2003/05/15 18:26:07 knoaman
|
---|
| 60 | * Partial implementation of the configurable memory manager.
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.8 2003/03/07 18:08:10 tng
|
---|
| 63 | * Return a reference instead of void for operator=
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.7 2002/11/07 21:59:22 tng
|
---|
| 66 | * Pass elemDecl to XMLValidator::validateAttrValue so that we can include element name in error message.
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.6 2002/11/04 15:00:21 tng
|
---|
| 69 | * C++ Namespace Support.
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.5 2002/09/04 18:17:55 tng
|
---|
| 72 | * Do not set IDREF to used during prevalidation.
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.4 2002/08/20 16:54:11 tng
|
---|
| 75 | * [Bug 6251] Info during compilation.
|
---|
| 76 | *
|
---|
| 77 | * Revision 1.3 2002/07/11 18:55:44 knoaman
|
---|
| 78 | * Add a flag to the preContentValidation method to indicate whether to validate
|
---|
| 79 | * default/fixed attributes or not.
|
---|
| 80 | *
|
---|
| 81 | * Revision 1.2 2002/02/20 18:17:01 tng
|
---|
| 82 | * [Bug 5977] Warnings on generating apiDocs.
|
---|
| 83 | *
|
---|
| 84 | * Revision 1.1.1.1 2002/02/01 22:21:52 peiyongz
|
---|
| 85 | * sane_include
|
---|
| 86 | *
|
---|
| 87 | * Revision 1.17 2001/11/30 22:18:18 peiyongz
|
---|
| 88 | * cleanUp function made member function
|
---|
| 89 | * cleanUp object moved to file scope
|
---|
| 90 | * double mutex lock removed
|
---|
| 91 | *
|
---|
| 92 | * Revision 1.16 2001/11/13 13:24:46 tng
|
---|
| 93 | * Deprecate function XMLValidator::checkRootElement.
|
---|
| 94 | *
|
---|
| 95 | * Revision 1.15 2001/10/24 23:46:52 peiyongz
|
---|
| 96 | * [Bug 4342] fix the leak.
|
---|
| 97 | *
|
---|
| 98 | * Revision 1.14 2001/06/05 16:51:17 knoaman
|
---|
| 99 | * Add 'const' to getGrammar - submitted by Peter A. Volchek.
|
---|
| 100 | *
|
---|
| 101 | * Revision 1.13 2001/05/11 13:25:33 tng
|
---|
| 102 | * Copyright update.
|
---|
| 103 | *
|
---|
| 104 | * Revision 1.12 2001/05/03 20:34:22 tng
|
---|
| 105 | * Schema: SchemaValidator update
|
---|
| 106 | *
|
---|
| 107 | * Revision 1.11 2001/04/19 18:16:53 tng
|
---|
| 108 | * Schema: SchemaValidator update, and use QName in Content Model
|
---|
| 109 | *
|
---|
| 110 | * Revision 1.10 2001/03/21 21:56:03 tng
|
---|
| 111 | * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
|
---|
| 112 | *
|
---|
| 113 | * Revision 1.9 2001/02/26 19:21:33 tng
|
---|
| 114 | * Schema: add parameter prefix in findElem and findAttr.
|
---|
| 115 | *
|
---|
| 116 | * Revision 1.8 2000/12/14 18:49:58 tng
|
---|
| 117 | * Fix API document generation warning: "Warning: end of member group without matching begin"
|
---|
| 118 | *
|
---|
| 119 | * Revision 1.7 2000/08/09 22:09:09 jpolast
|
---|
| 120 | * added const XMLCh* getURIText()
|
---|
| 121 | * allows parsers to use const URIs instead of appending
|
---|
| 122 | * to a XMLBuffer.
|
---|
| 123 | *
|
---|
| 124 | * Revision 1.6 2000/03/02 19:54:25 roddey
|
---|
| 125 | * This checkin includes many changes done while waiting for the
|
---|
| 126 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
| 127 | * available elsewhere.
|
---|
| 128 | *
|
---|
| 129 | * Revision 1.5 2000/02/24 20:00:24 abagchi
|
---|
| 130 | * Swat for removing Log from API docs
|
---|
| 131 | *
|
---|
| 132 | * Revision 1.4 2000/02/15 23:59:07 roddey
|
---|
| 133 | * More updated documentation of Framework classes.
|
---|
| 134 | *
|
---|
| 135 | * Revision 1.3 2000/02/15 01:21:31 roddey
|
---|
| 136 | * Some initial documentation improvements. More to come...
|
---|
| 137 | *
|
---|
| 138 | * Revision 1.2 2000/02/06 07:47:49 rahulj
|
---|
| 139 | * Year 2K copyright swat.
|
---|
| 140 | *
|
---|
| 141 | * Revision 1.1.1.1 1999/11/09 01:08:38 twl
|
---|
| 142 | * Initial checkin
|
---|
| 143 | *
|
---|
| 144 | * Revision 1.4 1999/11/08 20:44:41 rahul
|
---|
| 145 | * Swat for adding in Product name and CVS comment log variable.
|
---|
| 146 | *
|
---|
| 147 | */
|
---|
| 148 |
|
---|
| 149 |
|
---|
| 150 | #if !defined(XMLVALIDATOR_HPP)
|
---|
| 151 | #define XMLVALIDATOR_HPP
|
---|
| 152 |
|
---|
| 153 | #include <xercesc/framework/XMLAttr.hpp>
|
---|
| 154 | #include <xercesc/framework/XMLValidityCodes.hpp>
|
---|
| 155 |
|
---|
| 156 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 157 |
|
---|
| 158 | class ReaderMgr;
|
---|
| 159 | class XMLBufferMgr;
|
---|
| 160 | class XMLElementDecl;
|
---|
| 161 | class XMLScanner;
|
---|
| 162 | class Grammar;
|
---|
| 163 |
|
---|
| 164 |
|
---|
| 165 | /**
|
---|
| 166 | * This abstract class provides the interface for all validators. This is
|
---|
| 167 | * the simple amount of API that all validators must honor, in order for
|
---|
| 168 | * the scanner to use them to do validation. All validators will actually
|
---|
| 169 | * contain much more functionality than is accessible via this common API,
|
---|
| 170 | * but that functionality requires that you know what type of validator you
|
---|
| 171 | * are dealing with.
|
---|
| 172 | *
|
---|
| 173 | * Basically, at this level, the primary concern is to be able to query
|
---|
| 174 | * core information about elements and attributes. Adding decls to the
|
---|
| 175 | * validator requires that you go through the derived interface because they
|
---|
| 176 | * all have their own decl types. At this level, we can return information
|
---|
| 177 | * via the base decl classes, from which each validator derives its own
|
---|
| 178 | * decl classes.
|
---|
| 179 | */
|
---|
| 180 | class XMLPARSER_EXPORT XMLValidator : public XMemory
|
---|
| 181 | {
|
---|
| 182 | public:
|
---|
| 183 | // -----------------------------------------------------------------------
|
---|
| 184 | // Constructors are hidden, just the virtual destructor is exposed
|
---|
| 185 | // -----------------------------------------------------------------------
|
---|
| 186 |
|
---|
| 187 | /** @name Destructor */
|
---|
| 188 | //@{
|
---|
| 189 |
|
---|
| 190 | /**
|
---|
| 191 | * The derived class should clean up its allocated data, then this class
|
---|
| 192 | * will do the same for data allocated at this level.
|
---|
| 193 | */
|
---|
| 194 | virtual ~XMLValidator()
|
---|
| 195 | {
|
---|
| 196 | }
|
---|
| 197 | //@}
|
---|
| 198 |
|
---|
| 199 |
|
---|
| 200 | // -----------------------------------------------------------------------
|
---|
| 201 | // The virtual validator interface
|
---|
| 202 | // -----------------------------------------------------------------------
|
---|
| 203 |
|
---|
| 204 | /** @name Virtual validator interface */
|
---|
| 205 | //@{
|
---|
| 206 |
|
---|
| 207 | /**
|
---|
| 208 | * The derived class should look up its declaration of the passed element
|
---|
| 209 | * from its element pool. It should then use the content model description
|
---|
| 210 | * contained in that element declaration to validate that the passed list
|
---|
| 211 | * of child elements are valid for that content model. The count can be
|
---|
| 212 | * zero, indicating no child elements.
|
---|
| 213 | *
|
---|
| 214 | * Note that whitespace and text content are not validated here. Those are
|
---|
| 215 | * handled by the scanner. So only element ids are provided here.
|
---|
| 216 | *
|
---|
| 217 | * @param elemDecl The element whose content is to be checked.
|
---|
| 218 | *
|
---|
| 219 | * @param children An array of element QName which represent the elements
|
---|
| 220 | * found within the parent element, i.e. the content
|
---|
| 221 | * to be validated.
|
---|
| 222 | *
|
---|
| 223 | * @param childCount The number of elements in the childIds array. It can
|
---|
| 224 | * be zero if the element had none.
|
---|
| 225 | */
|
---|
| 226 | virtual int checkContent
|
---|
| 227 | (
|
---|
| 228 | XMLElementDecl* const elemDecl
|
---|
| 229 | , QName** const children
|
---|
| 230 | , const unsigned int childCount
|
---|
| 231 | ) = 0;
|
---|
| 232 |
|
---|
| 233 | /**
|
---|
| 234 | * The derived class should fault in the passed XMLAttr value. It should
|
---|
| 235 | * use the passeed attribute definition (which is passed via the base
|
---|
| 236 | * type so it must often be downcast to the appropriate type for the
|
---|
| 237 | * derived validator class), to fill in the passed attribute. This is done
|
---|
| 238 | * as a performance enhancement since the derived class has more direct
|
---|
| 239 | * access to the information.
|
---|
| 240 | */
|
---|
| 241 | virtual void faultInAttr
|
---|
| 242 | (
|
---|
| 243 | XMLAttr& toFill
|
---|
| 244 | , const XMLAttDef& attDef
|
---|
| 245 | ) const = 0;
|
---|
| 246 |
|
---|
| 247 | /**
|
---|
| 248 | * This method is called by the scanner after a Grammar is scanned.
|
---|
| 249 | */
|
---|
| 250 | virtual void preContentValidation(bool reuseGrammar,
|
---|
| 251 | bool validateDefAttr = false) = 0;
|
---|
| 252 |
|
---|
| 253 | /**
|
---|
| 254 | * This method is called by the scanner after the parse has completed. It
|
---|
| 255 | * gives the validator a chance to check certain things that can only be
|
---|
| 256 | * checked after the whole document has been parsed, such as referential
|
---|
| 257 | * integrity of ID/IDREF pairs and so forth. The validator should just
|
---|
| 258 | * issue errors for any problems it finds.
|
---|
| 259 | */
|
---|
| 260 | virtual void postParseValidation() = 0;
|
---|
| 261 |
|
---|
| 262 | /**
|
---|
| 263 | * This method is called by the scanner before a new document is about
|
---|
| 264 | * to start. It gives the validator a change to reset itself in preperation
|
---|
| 265 | * for another validation pass.
|
---|
| 266 | */
|
---|
| 267 | virtual void reset() = 0;
|
---|
| 268 |
|
---|
| 269 | /**
|
---|
| 270 | * The derived class should return a boolean that indicates whether it
|
---|
| 271 | * requires namespace processing or not. Some do and some allow it to be
|
---|
| 272 | * optional. This flag is used to control whether the client code's
|
---|
| 273 | * requests to disable namespace processing can be honored or not.
|
---|
| 274 | */
|
---|
| 275 | virtual bool requiresNamespaces() const = 0;
|
---|
| 276 |
|
---|
| 277 | /**
|
---|
| 278 | * The derived class should apply any rules to the passed attribute value
|
---|
| 279 | * that are above and beyond those defined by XML 1.0. The scanner itself
|
---|
| 280 | * will impose XML 1.0 rules, based on the type of the attribute. This
|
---|
| 281 | * will generally be used to check things such as range checks and other
|
---|
| 282 | * datatype related validation.
|
---|
| 283 | *
|
---|
| 284 | * If the value breaks any rules as defined by the derived class, it
|
---|
| 285 | * should just issue errors as usual.
|
---|
| 286 | */
|
---|
| 287 | virtual void validateAttrValue
|
---|
| 288 | (
|
---|
| 289 | const XMLAttDef* attDef
|
---|
| 290 | , const XMLCh* const attrValue
|
---|
| 291 | , bool preValidation = false
|
---|
| 292 | , const XMLElementDecl* elemDecl = 0
|
---|
| 293 | ) = 0;
|
---|
| 294 |
|
---|
| 295 | /**
|
---|
| 296 | * The derived class should apply any rules to the passed element decl
|
---|
| 297 | * that are above and beyond those defined by XML 1.0.
|
---|
| 298 | *
|
---|
| 299 | * If the value breaks any rules as defined by the derived class, it
|
---|
| 300 | * should just issue errors as usual.
|
---|
| 301 | */
|
---|
| 302 | virtual void validateElement
|
---|
| 303 | (
|
---|
| 304 | const XMLElementDecl* elemDef
|
---|
| 305 | ) = 0;
|
---|
| 306 |
|
---|
| 307 | /**
|
---|
| 308 | * Retrieve the Grammar used
|
---|
| 309 | */
|
---|
| 310 | virtual Grammar* getGrammar() const =0;
|
---|
| 311 |
|
---|
| 312 | /**
|
---|
| 313 | * Set the Grammar
|
---|
| 314 | */
|
---|
| 315 | virtual void setGrammar(Grammar* aGrammar) =0;
|
---|
| 316 |
|
---|
| 317 |
|
---|
| 318 | //@}
|
---|
| 319 |
|
---|
| 320 | // -----------------------------------------------------------------------
|
---|
| 321 | // Virtual DTD handler interface.
|
---|
| 322 | // -----------------------------------------------------------------------
|
---|
| 323 |
|
---|
| 324 | /** @name Virtual DTD handler interface */
|
---|
| 325 | //@{
|
---|
| 326 |
|
---|
| 327 | /**
|
---|
| 328 | * This method allows the scanner to ask the validator if it handles
|
---|
| 329 | * DTDs or not.
|
---|
| 330 | */
|
---|
| 331 | virtual bool handlesDTD() const = 0;
|
---|
| 332 |
|
---|
| 333 | // -----------------------------------------------------------------------
|
---|
| 334 | // Virtual Schema handler interface.
|
---|
| 335 | // -----------------------------------------------------------------------
|
---|
| 336 |
|
---|
| 337 | /** @name Virtual Schema handler interface */
|
---|
| 338 |
|
---|
| 339 | /**
|
---|
| 340 | * This method allows the scanner to ask the validator if it handles
|
---|
| 341 | * Schema or not.
|
---|
| 342 | */
|
---|
| 343 | virtual bool handlesSchema() const = 0;
|
---|
| 344 |
|
---|
| 345 | //@}
|
---|
| 346 |
|
---|
| 347 | // -----------------------------------------------------------------------
|
---|
| 348 | // Setter methods
|
---|
| 349 | //
|
---|
| 350 | // setScannerInfo() is called by the scanner to tell the validator
|
---|
| 351 | // about the stuff it needs to have access to.
|
---|
| 352 | // -----------------------------------------------------------------------
|
---|
| 353 |
|
---|
| 354 | /** @name Setter methods */
|
---|
| 355 | //@{
|
---|
| 356 |
|
---|
| 357 | /**
|
---|
| 358 | * @param owningScanner This is a pointer to the scanner to which the
|
---|
| 359 | * validator belongs. The validator will often
|
---|
| 360 | * need to query state data from the scanner.
|
---|
| 361 | *
|
---|
| 362 | * @param readerMgr This is a pointer to the reader manager that is
|
---|
| 363 | * being used by the scanner.
|
---|
| 364 | *
|
---|
| 365 | * @param bufMgr This is the buffer manager of the scanner. This
|
---|
| 366 | * is provided as a convenience so that the validator
|
---|
| 367 | * doesn't have to create its own buffer manager
|
---|
| 368 | * during the parse process.
|
---|
| 369 | */
|
---|
| 370 | void setScannerInfo
|
---|
| 371 | (
|
---|
| 372 | XMLScanner* const owningScanner
|
---|
| 373 | , ReaderMgr* const readerMgr
|
---|
| 374 | , XMLBufferMgr* const bufMgr
|
---|
| 375 | );
|
---|
| 376 |
|
---|
| 377 | /**
|
---|
| 378 | * This method is called to set an error reporter on the validator via
|
---|
| 379 | * which it will report any errors it sees during parsing or validation.
|
---|
| 380 | * This is generally called by the owning scanner.
|
---|
| 381 | *
|
---|
| 382 | * @param errorReporter A pointer to the error reporter to use. This
|
---|
| 383 | * is not adopted, just referenced so the caller
|
---|
| 384 | * remains responsible for its cleanup, if any.
|
---|
| 385 | */
|
---|
| 386 | void setErrorReporter
|
---|
| 387 | (
|
---|
| 388 | XMLErrorReporter* const errorReporter
|
---|
| 389 | );
|
---|
| 390 |
|
---|
| 391 | //@}
|
---|
| 392 |
|
---|
| 393 |
|
---|
| 394 | // -----------------------------------------------------------------------
|
---|
| 395 | // Error emitter methods
|
---|
| 396 | // -----------------------------------------------------------------------
|
---|
| 397 |
|
---|
| 398 | /** @name Error emittor methods */
|
---|
| 399 | //@{
|
---|
| 400 |
|
---|
| 401 | /**
|
---|
| 402 | * This call is a convenience by which validators can emit errors. Most
|
---|
| 403 | * of the grunt work of loading the text, getting the current source
|
---|
| 404 | * location, ect... is handled here.
|
---|
| 405 | *
|
---|
| 406 | * If the loaded text has replacement parameters, then text strings can be
|
---|
| 407 | * passed. These will be used to replace the tokens {0}, {1}, {2}, and {3}
|
---|
| 408 | * in the order passed. So text1 will replace {0}, text2 will replace {1},
|
---|
| 409 | * and so forth.
|
---|
| 410 | *
|
---|
| 411 | * textX Up to four replacement parameters. They can be provided
|
---|
| 412 | * as either XMLCh strings, or local code page strings which
|
---|
| 413 | * will be transcoded internally.
|
---|
| 414 | *
|
---|
| 415 | * @param toEmit The error code to emit. it must be one of the defined
|
---|
| 416 | * validator error codes.
|
---|
| 417 | *
|
---|
| 418 | */
|
---|
| 419 | void emitError(const XMLValid::Codes toEmit);
|
---|
| 420 | void emitError
|
---|
| 421 | (
|
---|
| 422 | const XMLValid::Codes toEmit
|
---|
| 423 | , const XMLCh* const text1
|
---|
| 424 | , const XMLCh* const text2 = 0
|
---|
| 425 | , const XMLCh* const text3 = 0
|
---|
| 426 | , const XMLCh* const text4 = 0
|
---|
| 427 | );
|
---|
| 428 | void emitError
|
---|
| 429 | (
|
---|
| 430 | const XMLValid::Codes toEmit
|
---|
| 431 | , const char* const text1
|
---|
| 432 | , const char* const text2 = 0
|
---|
| 433 | , const char* const text3 = 0
|
---|
| 434 | , const char* const text4 = 0
|
---|
| 435 | );
|
---|
| 436 |
|
---|
| 437 | //@}
|
---|
| 438 |
|
---|
| 439 | // -----------------------------------------------------------------------
|
---|
| 440 | // Deprecated XMLValidator interface
|
---|
| 441 | // -----------------------------------------------------------------------
|
---|
| 442 | /**
|
---|
| 443 | *
|
---|
| 444 | * DEPRECATED.
|
---|
| 445 | * For those validators that contrain the possible root elements of a
|
---|
| 446 | * document to only particular elements, they should use this call to
|
---|
| 447 | * validate that the passed root element id is a legal root element.
|
---|
| 448 | */
|
---|
| 449 | bool checkRootElement
|
---|
| 450 | (
|
---|
| 451 | const unsigned int
|
---|
| 452 | ) { return true;};
|
---|
| 453 |
|
---|
| 454 | // -----------------------------------------------------------------------
|
---|
| 455 | // Notification that lazy data has been deleted
|
---|
| 456 | // -----------------------------------------------------------------------
|
---|
| 457 | static void reinitMsgMutex();
|
---|
| 458 |
|
---|
| 459 | static void reinitMsgLoader();
|
---|
| 460 |
|
---|
| 461 | protected :
|
---|
| 462 | // -----------------------------------------------------------------------
|
---|
| 463 | // Hidden constructors
|
---|
| 464 | // -----------------------------------------------------------------------
|
---|
| 465 | XMLValidator
|
---|
| 466 | (
|
---|
| 467 | XMLErrorReporter* const errReporter = 0
|
---|
| 468 | );
|
---|
| 469 |
|
---|
| 470 |
|
---|
| 471 | // -----------------------------------------------------------------------
|
---|
| 472 | // Protected getters
|
---|
| 473 | // -----------------------------------------------------------------------
|
---|
| 474 | const XMLBufferMgr* getBufMgr() const;
|
---|
| 475 | XMLBufferMgr* getBufMgr();
|
---|
| 476 | const ReaderMgr* getReaderMgr() const;
|
---|
| 477 | ReaderMgr* getReaderMgr();
|
---|
| 478 | const XMLScanner* getScanner() const;
|
---|
| 479 | XMLScanner* getScanner();
|
---|
| 480 |
|
---|
| 481 |
|
---|
| 482 | private :
|
---|
| 483 | // -----------------------------------------------------------------------
|
---|
| 484 | // Unimplemented Constructors and Operators
|
---|
| 485 | // -----------------------------------------------------------------------
|
---|
| 486 | XMLValidator(const XMLValidator&);
|
---|
| 487 | XMLValidator& operator=(const XMLValidator&);
|
---|
| 488 |
|
---|
| 489 |
|
---|
| 490 | // -----------------------------------------------------------------------
|
---|
| 491 | // Private data members
|
---|
| 492 | //
|
---|
| 493 | // fErrorReporter
|
---|
| 494 | // The error reporter we are to use, if any.
|
---|
| 495 | //
|
---|
| 496 | // -----------------------------------------------------------------------
|
---|
| 497 | XMLBufferMgr* fBufMgr;
|
---|
| 498 | XMLErrorReporter* fErrorReporter;
|
---|
| 499 | ReaderMgr* fReaderMgr;
|
---|
| 500 | XMLScanner* fScanner;
|
---|
| 501 | };
|
---|
| 502 |
|
---|
| 503 |
|
---|
| 504 | // -----------------------------------------------------------------------
|
---|
| 505 | // Setter methods
|
---|
| 506 | // -----------------------------------------------------------------------
|
---|
| 507 | inline void
|
---|
| 508 | XMLValidator::setScannerInfo(XMLScanner* const owningScanner
|
---|
| 509 | , ReaderMgr* const readerMgr
|
---|
| 510 | , XMLBufferMgr* const bufMgr)
|
---|
| 511 | {
|
---|
| 512 | // We don't own any of these, we just reference them
|
---|
| 513 | fScanner = owningScanner;
|
---|
| 514 | fReaderMgr = readerMgr;
|
---|
| 515 | fBufMgr = bufMgr;
|
---|
| 516 | }
|
---|
| 517 |
|
---|
| 518 | inline void
|
---|
| 519 | XMLValidator::setErrorReporter(XMLErrorReporter* const errorReporter)
|
---|
| 520 | {
|
---|
| 521 | fErrorReporter = errorReporter;
|
---|
| 522 | }
|
---|
| 523 |
|
---|
| 524 |
|
---|
| 525 | // ---------------------------------------------------------------------------
|
---|
| 526 | // XMLValidator: Protected getter
|
---|
| 527 | // ---------------------------------------------------------------------------
|
---|
| 528 | inline const XMLBufferMgr* XMLValidator::getBufMgr() const
|
---|
| 529 | {
|
---|
| 530 | return fBufMgr;
|
---|
| 531 | }
|
---|
| 532 |
|
---|
| 533 | inline XMLBufferMgr* XMLValidator::getBufMgr()
|
---|
| 534 | {
|
---|
| 535 | return fBufMgr;
|
---|
| 536 | }
|
---|
| 537 |
|
---|
| 538 | inline const ReaderMgr* XMLValidator::getReaderMgr() const
|
---|
| 539 | {
|
---|
| 540 | return fReaderMgr;
|
---|
| 541 | }
|
---|
| 542 |
|
---|
| 543 | inline ReaderMgr* XMLValidator::getReaderMgr()
|
---|
| 544 | {
|
---|
| 545 | return fReaderMgr;
|
---|
| 546 | }
|
---|
| 547 |
|
---|
| 548 | inline const XMLScanner* XMLValidator::getScanner() const
|
---|
| 549 | {
|
---|
| 550 | return fScanner;
|
---|
| 551 | }
|
---|
| 552 |
|
---|
| 553 | inline XMLScanner* XMLValidator::getScanner()
|
---|
| 554 | {
|
---|
| 555 | return fScanner;
|
---|
| 556 | }
|
---|
| 557 |
|
---|
| 558 | XERCES_CPP_NAMESPACE_END
|
---|
| 559 |
|
---|
| 560 | #endif
|
---|