[2674] | 1 | /* |
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 4 | * this work for additional information regarding copyright ownership. |
---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 6 | * (the "License"); you may not use this file except in compliance with |
---|
| 7 | * the License. You may obtain a copy of the License at |
---|
| 8 | * |
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | * |
---|
| 11 | * Unless required by applicable law or agreed to in writing, software |
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | * See the License for the specific language governing permissions and |
---|
| 15 | * limitations under the License. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | /* |
---|
| 19 | * $Id: SAX2XMLReaderImpl.hpp 569031 2007-08-23 15:05:28Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(SAX2XMLReaderImpl_HPP) |
---|
| 23 | #define SAX2XMLReaderImpl_HPP |
---|
| 24 | |
---|
| 25 | #include <xercesc/parsers/SAXParser.hpp> |
---|
| 26 | #include <xercesc/sax/Parser.hpp> |
---|
| 27 | #include <xercesc/framework/XMLBuffer.hpp> |
---|
| 28 | #include <xercesc/internal/VecAttributesImpl.hpp> |
---|
| 29 | #include <xercesc/sax2/SAX2XMLReader.hpp> |
---|
| 30 | #include <xercesc/util/RefStackOf.hpp> |
---|
| 31 | #include <xercesc/util/SecurityManager.hpp> |
---|
| 32 | #include <xercesc/util/ValueStackOf.hpp> |
---|
| 33 | |
---|
| 34 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | class ContentHandler; |
---|
| 38 | class LexicalHandler; |
---|
| 39 | class DeclHandler; |
---|
| 40 | class GrammarResolver; |
---|
| 41 | class XMLGrammarPool; |
---|
| 42 | class XMLResourceIdentifier; |
---|
| 43 | class PSVIHandler; |
---|
| 44 | |
---|
| 45 | /** |
---|
| 46 | * This class implements the SAX2 'XMLReader' interface and should be |
---|
| 47 | * used by applications wishing to parse the XML files using SAX2. |
---|
| 48 | * It allows the client program to install SAX2 handlers for event |
---|
| 49 | * callbacks. |
---|
| 50 | * |
---|
| 51 | * <p>It can be used to instantiate a validating or non-validating |
---|
| 52 | * parser, by setting a member flag.</p> |
---|
| 53 | * |
---|
| 54 | * we basically re-use the existing SAX1 parser code, but provide a |
---|
| 55 | * new implementation of XMLContentHandler that raises the new |
---|
| 56 | * SAX2 style events |
---|
| 57 | * |
---|
| 58 | */ |
---|
| 59 | |
---|
| 60 | class PARSERS_EXPORT SAX2XMLReaderImpl : |
---|
| 61 | public XMemory |
---|
| 62 | , public SAX2XMLReader |
---|
| 63 | , public XMLDocumentHandler |
---|
| 64 | , public XMLErrorReporter |
---|
| 65 | , public XMLEntityHandler |
---|
| 66 | , public DocTypeHandler |
---|
| 67 | { |
---|
| 68 | public : |
---|
| 69 | // ----------------------------------------------------------------------- |
---|
| 70 | // Constructors and Destructor |
---|
| 71 | // ----------------------------------------------------------------------- |
---|
| 72 | /** @name Constructors and Destructor */ |
---|
| 73 | //@{ |
---|
| 74 | /** The default constructor */ |
---|
| 75 | SAX2XMLReaderImpl( |
---|
| 76 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 77 | , XMLGrammarPool* const gramPool = 0 |
---|
| 78 | ); |
---|
| 79 | |
---|
| 80 | /** The destructor */ |
---|
| 81 | ~SAX2XMLReaderImpl() ; |
---|
| 82 | //@} |
---|
| 83 | |
---|
| 84 | //----------------------------------------------------------------------- |
---|
| 85 | // Implementation of SAX2XMLReader Interface |
---|
| 86 | //----------------------------------------------------------------------- |
---|
| 87 | //----------------------------------------------------------------------- |
---|
| 88 | // The XMLReader interface |
---|
| 89 | //----------------------------------------------------------------------- |
---|
| 90 | /** @name Implementation of SAX 2.0 XMLReader interface's. */ |
---|
| 91 | //@{ |
---|
| 92 | |
---|
| 93 | /** |
---|
| 94 | * This method returns the installed content handler. |
---|
| 95 | * |
---|
| 96 | * @return A pointer to the installed content handler object. |
---|
| 97 | */ |
---|
| 98 | virtual ContentHandler* getContentHandler() const ; |
---|
| 99 | |
---|
| 100 | /** |
---|
| 101 | * This method returns the installed DTD handler. |
---|
| 102 | * |
---|
| 103 | * @return A pointer to the installed DTD handler object. |
---|
| 104 | */ |
---|
| 105 | virtual DTDHandler* getDTDHandler() const ; |
---|
| 106 | |
---|
| 107 | /** |
---|
| 108 | * This method returns the installed entity resolver. |
---|
| 109 | * |
---|
| 110 | * @return A pointer to the installed entity resolver object. |
---|
| 111 | */ |
---|
| 112 | virtual EntityResolver* getEntityResolver() const ; |
---|
| 113 | |
---|
| 114 | /** |
---|
| 115 | * This method returns the installed entity resolver. |
---|
| 116 | * |
---|
| 117 | * @return A pointer to the installed entity resolver object. |
---|
| 118 | */ |
---|
| 119 | virtual XMLEntityResolver* getXMLEntityResolver() const ; |
---|
| 120 | |
---|
| 121 | /** |
---|
| 122 | * This method returns the installed error handler. |
---|
| 123 | * |
---|
| 124 | * @return A pointer to the installed error handler object. |
---|
| 125 | */ |
---|
| 126 | virtual ErrorHandler* getErrorHandler() const ; |
---|
| 127 | |
---|
| 128 | /** |
---|
| 129 | * This method returns the installed PSVI handler. |
---|
| 130 | * |
---|
| 131 | * @return A pointer to the installed PSVI handler object. |
---|
| 132 | */ |
---|
| 133 | virtual PSVIHandler* getPSVIHandler() const ; |
---|
| 134 | |
---|
| 135 | /** |
---|
| 136 | * Query the current state of any feature in a SAX2 XMLReader. |
---|
| 137 | * |
---|
| 138 | * @param name The unique identifier (URI) of the feature being set. |
---|
| 139 | * @return The current state of the feature. |
---|
| 140 | * @exception SAXNotRecognizedException If the requested feature is not known. |
---|
| 141 | */ |
---|
| 142 | virtual bool getFeature(const XMLCh* const name) const ; |
---|
| 143 | |
---|
| 144 | /** |
---|
| 145 | * Query the current value of a property in a SAX2 XMLReader. |
---|
| 146 | * |
---|
| 147 | * The parser owns the returned pointer. The memory allocated for |
---|
| 148 | * the returned pointer will be destroyed when the parser is deleted. |
---|
| 149 | * |
---|
| 150 | * To ensure assessiblity of the returned information after the parser |
---|
| 151 | * is deleted, callers need to copy and store the returned information |
---|
| 152 | * somewhere else; otherwise you may get unexpected result. Since the returned |
---|
| 153 | * pointer is a generic void pointer, see |
---|
| 154 | * http://xerces.apache.org/xerces-c/program-sax2.html#SAX2Properties to learn |
---|
| 155 | * exactly what type of property value each property returns for replication. |
---|
| 156 | * |
---|
| 157 | * @param name The unique identifier (URI) of the property being set. |
---|
| 158 | * @return The current value of the property. The pointer spans the same |
---|
| 159 | * life-time as the parser. A null pointer is returned if nothing |
---|
| 160 | * was specified externally. |
---|
| 161 | * @exception SAXNotRecognizedException If the requested property is not known. |
---|
| 162 | */ |
---|
| 163 | virtual void* getProperty(const XMLCh* const name) const ; |
---|
| 164 | |
---|
| 165 | /** |
---|
| 166 | * Allow an application to register a document event handler. |
---|
| 167 | * |
---|
| 168 | * If the application does not register a document handler, all |
---|
| 169 | * document events reported by the SAX parser will be silently |
---|
| 170 | * ignored (this is the default behaviour implemented by |
---|
| 171 | * HandlerBase). |
---|
| 172 | * |
---|
| 173 | * Applications may register a new or different handler in the |
---|
| 174 | * middle of a parse, and the SAX parser must begin using the new |
---|
| 175 | * handler immediately. |
---|
| 176 | * |
---|
| 177 | * @param handler The document handler. |
---|
| 178 | * @see DocumentHandler#DocumentHandler |
---|
| 179 | * @see HandlerBase#HandlerBase |
---|
| 180 | */ |
---|
| 181 | virtual void setContentHandler(ContentHandler* const handler) ; |
---|
| 182 | |
---|
| 183 | /** |
---|
| 184 | * Allow an application to register a DTD event handler. |
---|
| 185 | * |
---|
| 186 | * If the application does not register a DTD handler, all DTD |
---|
| 187 | * events reported by the SAX parser will be silently ignored (this |
---|
| 188 | * is the default behaviour implemented by HandlerBase). |
---|
| 189 | * |
---|
| 190 | * Applications may register a new or different handler in the middle |
---|
| 191 | * of a parse, and the SAX parser must begin using the new handler |
---|
| 192 | * immediately. |
---|
| 193 | * |
---|
| 194 | * @param handler The DTD handler. |
---|
| 195 | * @see DTDHandler#DTDHandler |
---|
| 196 | * @see HandlerBase#HandlerBase |
---|
| 197 | */ |
---|
| 198 | virtual void setDTDHandler(DTDHandler* const handler) ; |
---|
| 199 | |
---|
| 200 | /** |
---|
| 201 | * Allow an application to register a custom entity resolver. |
---|
| 202 | * |
---|
| 203 | * If the application does not register an entity resolver, the |
---|
| 204 | * SAX parser will resolve system identifiers and open connections |
---|
| 205 | * to entities itself (this is the default behaviour implemented in |
---|
| 206 | * DefaultHandler). |
---|
| 207 | * |
---|
| 208 | * Applications may register a new or different entity resolver |
---|
| 209 | * in the middle of a parse, and the SAX parser must begin using |
---|
| 210 | * the new resolver immediately. |
---|
| 211 | * |
---|
| 212 | * <i>Any previously set entity resolver is merely dropped, since the parser |
---|
| 213 | * does not own them. If both setEntityResolver and setXMLEntityResolver |
---|
| 214 | * are called, then the last one is used.</i> |
---|
| 215 | * |
---|
| 216 | * @param resolver The object for resolving entities. |
---|
| 217 | * @see EntityResolver#EntityResolver |
---|
| 218 | * @see DefaultHandler#DefaultHandler |
---|
| 219 | */ |
---|
| 220 | virtual void setEntityResolver(EntityResolver* const resolver) ; |
---|
| 221 | |
---|
| 222 | /** Set the entity resolver |
---|
| 223 | * |
---|
| 224 | * This method allows applications to install their own entity |
---|
| 225 | * resolver. By installing an entity resolver, the applications |
---|
| 226 | * can trap and potentially redirect references to external |
---|
| 227 | * entities. |
---|
| 228 | * |
---|
| 229 | * <i>Any previously set entity resolver is merely dropped, since the parser |
---|
| 230 | * does not own them. If both setEntityResolver and setXMLEntityResolver |
---|
| 231 | * are called, then the last one is used.</i> |
---|
| 232 | * |
---|
| 233 | * @param resolver A const pointer to the user supplied entity |
---|
| 234 | * resolver. |
---|
| 235 | * |
---|
| 236 | * @see #getXMLEntityResolver |
---|
| 237 | */ |
---|
| 238 | virtual void setXMLEntityResolver(XMLEntityResolver* const resolver) ; |
---|
| 239 | |
---|
| 240 | /** |
---|
| 241 | * Allow an application to register an error event handler. |
---|
| 242 | * |
---|
| 243 | * If the application does not register an error event handler, |
---|
| 244 | * all error events reported by the SAX parser will be silently |
---|
| 245 | * ignored, except for fatalError, which will throw a SAXException |
---|
| 246 | * (this is the default behaviour implemented by HandlerBase). |
---|
| 247 | * |
---|
| 248 | * Applications may register a new or different handler in the |
---|
| 249 | * middle of a parse, and the SAX parser must begin using the new |
---|
| 250 | * handler immediately. |
---|
| 251 | * |
---|
| 252 | * @param handler The error handler. |
---|
| 253 | * @see ErrorHandler#ErrorHandler |
---|
| 254 | * @see SAXException#SAXException |
---|
| 255 | * @see HandlerBase#HandlerBase |
---|
| 256 | */ |
---|
| 257 | virtual void setErrorHandler(ErrorHandler* const handler) ; |
---|
| 258 | |
---|
| 259 | /** |
---|
| 260 | * This method installs the user specified PSVI handler on |
---|
| 261 | * the parser. |
---|
| 262 | * |
---|
| 263 | * @param handler A pointer to the PSVI handler to be called |
---|
| 264 | * when the parser comes across 'PSVI' events |
---|
| 265 | * as per the schema specification. |
---|
| 266 | */ |
---|
| 267 | virtual void setPSVIHandler(PSVIHandler* const handler); |
---|
| 268 | |
---|
| 269 | /** |
---|
| 270 | * Set the state of any feature in a SAX2 XMLReader. |
---|
| 271 | * Supported features in SAX2 for xerces-c are: |
---|
| 272 | * <br>(See http://xerces.apache.org/xerces-c/program-sax2.html#SAX2Features for detail description). |
---|
| 273 | * |
---|
| 274 | * <br>http://xml.org/sax/features/validation (default: false) |
---|
| 275 | * <br>http://xml.org/sax/features/namespaces (default: true) |
---|
| 276 | * <br>http://xml.org/sax/features/namespace-prefixes (default: false) |
---|
| 277 | * <br>http://apache.org/xml/features/validation/dynamic (default: false) |
---|
| 278 | * <br>http://apache.org/xml/features/validation/reuse-grammar (default: false) |
---|
| 279 | * <br>http://apache.org/xml/features/validation/schema (default: true) |
---|
| 280 | * <br>http://apache.org/xml/features/validation/schema-full-checking (default: false) |
---|
| 281 | * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true) |
---|
| 282 | * <br>http://apache.org/xml/features/continue-after-fatal-error (default: false) |
---|
| 283 | * <br>http://apache.org/xml/features/validation-error-as-fatal (default: false) |
---|
| 284 | * <br>http://apache.org/xml/features/validation/reuse-validator (Deprecated) (default: false) |
---|
| 285 | * |
---|
| 286 | * @param name The unique identifier (URI) of the feature. |
---|
| 287 | * @param value The requested state of the feature (true or false). |
---|
| 288 | * @exception SAXNotRecognizedException If the requested feature is not known. |
---|
| 289 | * @exception SAXNotSupportedException Feature modification is not supported during parse |
---|
| 290 | * |
---|
| 291 | */ |
---|
| 292 | virtual void setFeature(const XMLCh* const name, const bool value) ; |
---|
| 293 | |
---|
| 294 | /** |
---|
| 295 | * Set the value of any property in a SAX2 XMLReader. |
---|
| 296 | * Supported properties in SAX2 for xerces-c are: |
---|
| 297 | * <br>(See http://xerces.apache.org/xerces-c/program-sax2.html#SAX2Properties for detail description). |
---|
| 298 | * |
---|
| 299 | * <br>http://apache.org/xml/properties/schema/external-schemaLocation |
---|
| 300 | * <br>http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation. |
---|
| 301 | * |
---|
| 302 | * It takes a void pointer as the property value. Application is required to initialize this void |
---|
| 303 | * pointer to a correct type. See http://xerces.apache.org/xerces-c/program-sax2.html#SAX2Properties |
---|
| 304 | * to learn exactly what type of property value each property expects for processing. |
---|
| 305 | * Passing a void pointer that was initialized with a wrong type will lead to unexpected result. |
---|
| 306 | * If the same property is set more than once, the last one takes effect. |
---|
| 307 | * |
---|
| 308 | * @param name The unique identifier (URI) of the property being set. |
---|
| 309 | * @param value The requested value for the property. See |
---|
| 310 | * http://xerces.apache.org/xerces-c/program-sax2.html#SAX2Properties to learn |
---|
| 311 | * exactly what type of property value each property expects for processing. |
---|
| 312 | * Passing a void pointer that was initialized with a wrong type will lead |
---|
| 313 | * to unexpected result. |
---|
| 314 | * @exception SAXNotRecognizedException If the requested property is not known. |
---|
| 315 | * @exception SAXNotSupportedException Property modification is not supported during parse |
---|
| 316 | */ |
---|
| 317 | virtual void setProperty(const XMLCh* const name, void* value) ; |
---|
| 318 | |
---|
| 319 | /** |
---|
| 320 | * Parse an XML document. |
---|
| 321 | * |
---|
| 322 | * The application can use this method to instruct the SAX parser |
---|
| 323 | * to begin parsing an XML document from any valid input |
---|
| 324 | * source (a character stream, a byte stream, or a URI). |
---|
| 325 | * |
---|
| 326 | * Applications may not invoke this method while a parse is in |
---|
| 327 | * progress (they should create a new Parser instead for each |
---|
| 328 | * additional XML document). Once a parse is complete, an |
---|
| 329 | * application may reuse the same Parser object, possibly with a |
---|
| 330 | * different input source. |
---|
| 331 | * |
---|
| 332 | * @param source The input source for the top-level of the |
---|
| 333 | * XML document. |
---|
| 334 | * @exception SAXException Any SAX exception, possibly |
---|
| 335 | * wrapping another exception. |
---|
| 336 | * @exception XMLException An exception from the parser or client |
---|
| 337 | * handler code. |
---|
| 338 | * @see InputSource#InputSource |
---|
| 339 | * @see #setEntityResolver |
---|
| 340 | * @see #setDTDHandler |
---|
| 341 | * @see #setDocumentHandler |
---|
| 342 | * @see #setErrorHandler |
---|
| 343 | */ |
---|
| 344 | virtual void parse |
---|
| 345 | ( |
---|
| 346 | const InputSource& source |
---|
| 347 | ) ; |
---|
| 348 | |
---|
| 349 | /** |
---|
| 350 | * Parse an XML document from a system identifier (URI). |
---|
| 351 | * |
---|
| 352 | * This method is a shortcut for the common case of reading a |
---|
| 353 | * document from a system identifier. It is the exact equivalent |
---|
| 354 | * of the following: |
---|
| 355 | * |
---|
| 356 | * parse(new URLInputSource(systemId)); |
---|
| 357 | * |
---|
| 358 | * If the system identifier is a URL, it must be fully resolved |
---|
| 359 | * by the application before it is passed to the parser. |
---|
| 360 | * |
---|
| 361 | * @param systemId The system identifier (URI). |
---|
| 362 | * @exception SAXException Any SAX exception, possibly |
---|
| 363 | * wrapping another exception. |
---|
| 364 | * @exception XMLException An exception from the parser or client |
---|
| 365 | * handler code. |
---|
| 366 | * @see #parse(InputSource) |
---|
| 367 | */ |
---|
| 368 | virtual void parse |
---|
| 369 | ( |
---|
| 370 | const XMLCh* const systemId |
---|
| 371 | ) ; |
---|
| 372 | |
---|
| 373 | /** |
---|
| 374 | * Parse an XML document from a system identifier (URI). |
---|
| 375 | * |
---|
| 376 | * This method is a shortcut for the common case of reading a |
---|
| 377 | * document from a system identifier. It is the exact equivalent |
---|
| 378 | * of the following: |
---|
| 379 | * |
---|
| 380 | * parse(new URLInputSource(systemId)); |
---|
| 381 | * |
---|
| 382 | * If the system identifier is a URL, it must be fully resolved |
---|
| 383 | * by the application before it is passed to the parser. |
---|
| 384 | * |
---|
| 385 | * @param systemId The system identifier (URI). |
---|
| 386 | * @exception SAXException Any SAX exception, possibly |
---|
| 387 | * wrapping another exception. |
---|
| 388 | * @exception XMLException An exception from the parser or client |
---|
| 389 | * handler code. |
---|
| 390 | * @see #parse(InputSource) |
---|
| 391 | */ |
---|
| 392 | virtual void parse |
---|
| 393 | ( |
---|
| 394 | const char* const systemId |
---|
| 395 | ) ; |
---|
| 396 | |
---|
| 397 | //@} |
---|
| 398 | |
---|
| 399 | // ----------------------------------------------------------------------- |
---|
| 400 | // SAX 2.0-ext |
---|
| 401 | // ----------------------------------------------------------------------- |
---|
| 402 | /** @name SAX 2.0-ext */ |
---|
| 403 | //@{ |
---|
| 404 | /** |
---|
| 405 | * This method returns the installed declaration handler. |
---|
| 406 | * |
---|
| 407 | * @return A pointer to the installed declaration handler object. |
---|
| 408 | */ |
---|
| 409 | virtual DeclHandler* getDeclarationHandler() const ; |
---|
| 410 | |
---|
| 411 | /** |
---|
| 412 | * This method returns the installed lexical handler. |
---|
| 413 | * |
---|
| 414 | * @return A pointer to the installed lexical handler object. |
---|
| 415 | */ |
---|
| 416 | virtual LexicalHandler* getLexicalHandler() const ; |
---|
| 417 | |
---|
| 418 | /** |
---|
| 419 | * Allow an application to register a declaration event handler. |
---|
| 420 | * |
---|
| 421 | * If the application does not register a declaration handler, |
---|
| 422 | * all events reported by the SAX parser will be silently |
---|
| 423 | * ignored. (this is the default behaviour implemented by DefaultHandler). |
---|
| 424 | * |
---|
| 425 | * Applications may register a new or different handler in the |
---|
| 426 | * middle of a parse, and the SAX parser must begin using the new |
---|
| 427 | * handler immediately. |
---|
| 428 | * |
---|
| 429 | * @param handler The DTD declaration handler. |
---|
| 430 | * @see DeclHandler#DeclHandler |
---|
| 431 | * @see SAXException#SAXException |
---|
| 432 | * @see DefaultHandler#DefaultHandler |
---|
| 433 | */ |
---|
| 434 | virtual void setDeclarationHandler(DeclHandler* const handler) ; |
---|
| 435 | |
---|
| 436 | /** |
---|
| 437 | * Allow an application to register a lexical event handler. |
---|
| 438 | * |
---|
| 439 | * If the application does not register a lexical handler, |
---|
| 440 | * all events reported by the SAX parser will be silently |
---|
| 441 | * ignored. (this is the default behaviour implemented by HandlerBase). |
---|
| 442 | * |
---|
| 443 | * Applications may register a new or different handler in the |
---|
| 444 | * middle of a parse, and the SAX parser must begin using the new |
---|
| 445 | * handler immediately. |
---|
| 446 | * |
---|
| 447 | * @param handler The error handler. |
---|
| 448 | * @see LexicalHandler#LexicalHandler |
---|
| 449 | * @see SAXException#SAXException |
---|
| 450 | * @see HandlerBase#HandlerBase |
---|
| 451 | */ |
---|
| 452 | virtual void setLexicalHandler(LexicalHandler* const handler) ; |
---|
| 453 | |
---|
| 454 | //@} |
---|
| 455 | |
---|
| 456 | // ----------------------------------------------------------------------- |
---|
| 457 | // Getter Methods |
---|
| 458 | // ----------------------------------------------------------------------- |
---|
| 459 | /** @name Getter Methods (Xerces-C specific) */ |
---|
| 460 | //@{ |
---|
| 461 | /** |
---|
| 462 | * This method is used to get the current validator. |
---|
| 463 | * |
---|
| 464 | * <b>SAX2XMLReader assumes responsibility for the validator. It will be |
---|
| 465 | * deleted when the XMLReader is destroyed.</b> |
---|
| 466 | * |
---|
| 467 | * @return A pointer to the validator. An application should not deleted |
---|
| 468 | * the object returned. |
---|
| 469 | * |
---|
| 470 | */ |
---|
| 471 | virtual XMLValidator* getValidator() const ; |
---|
| 472 | //@} |
---|
| 473 | |
---|
| 474 | /** Get error count from the last parse operation. |
---|
| 475 | * |
---|
| 476 | * This method returns the error count from the last parse |
---|
| 477 | * operation. Note that this count is actually stored in the |
---|
| 478 | * scanner, so this method simply returns what the |
---|
| 479 | * scanner reports. |
---|
| 480 | * |
---|
| 481 | * @return number of errors encountered during the latest |
---|
| 482 | * parse operation. |
---|
| 483 | */ |
---|
| 484 | virtual int getErrorCount() const ; |
---|
| 485 | |
---|
| 486 | /** |
---|
| 487 | * This method returns the state of the parser's |
---|
| 488 | * exit-on-First-Fatal-Error flag. |
---|
| 489 | * |
---|
| 490 | * <p>Or you can query the feature "http://apache.org/xml/features/continue-after-fatal-error" |
---|
| 491 | * which indicates the opposite state.</p> |
---|
| 492 | * |
---|
| 493 | * @return true, if the parser is currently configured to |
---|
| 494 | * exit on the first fatal error, false otherwise. |
---|
| 495 | * |
---|
| 496 | * @see #setExitOnFirstFatalError |
---|
| 497 | * @see #getFeature |
---|
| 498 | */ |
---|
| 499 | virtual bool getExitOnFirstFatalError() const ; |
---|
| 500 | |
---|
| 501 | /** |
---|
| 502 | * This method returns the state of the parser's |
---|
| 503 | * validation-constraint-fatal flag. |
---|
| 504 | * |
---|
| 505 | * <p>Or you can query the feature "http://apache.org/xml/features/validation-error-as-fatal" |
---|
| 506 | * which means the same thing. |
---|
| 507 | * |
---|
| 508 | * @return true, if the parser is currently configured to |
---|
| 509 | * set validation constraint errors as fatal, false |
---|
| 510 | * otherwise. |
---|
| 511 | * |
---|
| 512 | * @see #setValidationContraintFatal |
---|
| 513 | * @see #getFeature |
---|
| 514 | */ |
---|
| 515 | virtual bool getValidationConstraintFatal() const ; |
---|
| 516 | |
---|
| 517 | /** |
---|
| 518 | * Retrieve the grammar that is associated with the specified namespace key |
---|
| 519 | * |
---|
| 520 | * @param nameSpaceKey Namespace key |
---|
| 521 | * @return Grammar associated with the Namespace key. |
---|
| 522 | */ |
---|
| 523 | virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey); |
---|
| 524 | |
---|
| 525 | /** |
---|
| 526 | * Retrieve the grammar where the root element is declared. |
---|
| 527 | * |
---|
| 528 | * @return Grammar where root element declared |
---|
| 529 | */ |
---|
| 530 | virtual Grammar* getRootGrammar(); |
---|
| 531 | |
---|
| 532 | /** |
---|
| 533 | * Returns the string corresponding to a URI id from the URI string pool. |
---|
| 534 | * |
---|
| 535 | * @param uriId id of the string in the URI string pool. |
---|
| 536 | * @return URI string corresponding to the URI id. |
---|
| 537 | */ |
---|
| 538 | virtual const XMLCh* getURIText(unsigned int uriId) const; |
---|
| 539 | |
---|
| 540 | /** |
---|
| 541 | * Returns the current src offset within the input source. |
---|
| 542 | * To be used only while parsing is in progress. |
---|
| 543 | * |
---|
| 544 | * @return offset within the input source |
---|
| 545 | */ |
---|
| 546 | virtual unsigned int getSrcOffset() const; |
---|
| 547 | |
---|
| 548 | //@} |
---|
| 549 | |
---|
| 550 | // ----------------------------------------------------------------------- |
---|
| 551 | // Setter Methods |
---|
| 552 | // ----------------------------------------------------------------------- |
---|
| 553 | /** @name Setter Methods (Xerces-C specific) */ |
---|
| 554 | //@{ |
---|
| 555 | /** |
---|
| 556 | * This method is used to set a validator. |
---|
| 557 | * |
---|
| 558 | * <b>SAX2XMLReader assumes responsibility for the validator. It will be |
---|
| 559 | * deleted when the XMLReader is destroyed.</b> |
---|
| 560 | * |
---|
| 561 | * @param valueToAdopt A pointer to the validator that the reader should use. |
---|
| 562 | * |
---|
| 563 | */ |
---|
| 564 | virtual void setValidator(XMLValidator* valueToAdopt) ; |
---|
| 565 | |
---|
| 566 | /** |
---|
| 567 | * This method allows users to set the parser's behaviour when it |
---|
| 568 | * encounters the first fatal error. If set to true, the parser |
---|
| 569 | * will exit at the first fatal error. If false, then it will |
---|
| 570 | * report the error and continue processing. |
---|
| 571 | * |
---|
| 572 | * <p>The default value is 'true' and the parser exits on the |
---|
| 573 | * first fatal error.</p> |
---|
| 574 | * |
---|
| 575 | * <p>Or you can set the feature "http://apache.org/xml/features/continue-after-fatal-error" |
---|
| 576 | * which has the opposite behaviour.</p> |
---|
| 577 | * |
---|
| 578 | * <p>If both the feature above and this function are used, the latter takes effect.</p> |
---|
| 579 | * |
---|
| 580 | * @param newState The value specifying whether the parser should |
---|
| 581 | * continue or exit when it encounters the first |
---|
| 582 | * fatal error. |
---|
| 583 | * |
---|
| 584 | * @see #getExitOnFirstFatalError |
---|
| 585 | * @see #setFeature |
---|
| 586 | */ |
---|
| 587 | virtual void setExitOnFirstFatalError(const bool newState) ; |
---|
| 588 | |
---|
| 589 | /** |
---|
| 590 | * This method allows users to set the parser's behaviour when it |
---|
| 591 | * encounters a validtion constraint error. If set to true, and the |
---|
| 592 | * the parser will treat validation error as fatal and will exit depends on the |
---|
| 593 | * state of "getExitOnFirstFatalError". If false, then it will |
---|
| 594 | * report the error and continue processing. |
---|
| 595 | * |
---|
| 596 | * Note: setting this true does not mean the validation error will be printed with |
---|
| 597 | * the word "Fatal Error". It is still printed as "Error", but the parser |
---|
| 598 | * will exit if "setExitOnFirstFatalError" is set to true. |
---|
| 599 | * |
---|
| 600 | * <p>The default value is 'false'.</p> |
---|
| 601 | * |
---|
| 602 | * <p>Or you can set the feature "http://apache.org/xml/features/validation-error-as-fatal" |
---|
| 603 | * which means the same thing.</p> |
---|
| 604 | * |
---|
| 605 | * <p>If both the feature above and this function are used, the latter takes effect.</p> |
---|
| 606 | * |
---|
| 607 | * @param newState If true, the parser will exit if "setExitOnFirstFatalError" |
---|
| 608 | * is set to true. |
---|
| 609 | * |
---|
| 610 | * @see #getValidationConstraintFatal |
---|
| 611 | * @see #setExitOnFirstFatalError |
---|
| 612 | * @see #setFeature |
---|
| 613 | */ |
---|
| 614 | virtual void setValidationConstraintFatal(const bool newState) ; |
---|
| 615 | //@} |
---|
| 616 | |
---|
| 617 | |
---|
| 618 | // ----------------------------------------------------------------------- |
---|
| 619 | // Progressive scan methods |
---|
| 620 | // ----------------------------------------------------------------------- |
---|
| 621 | |
---|
| 622 | /** @name Progressive scan methods */ |
---|
| 623 | //@{ |
---|
| 624 | |
---|
| 625 | /** Begin a progressive parse operation |
---|
| 626 | * |
---|
| 627 | * This method is used to start a progressive parse on a XML file. |
---|
| 628 | * To continue parsing, subsequent calls must be to the parseNext |
---|
| 629 | * method. |
---|
| 630 | * |
---|
| 631 | * It scans through the prolog and returns a token to be used on |
---|
| 632 | * subsequent scanNext() calls. If the return value is true, then the |
---|
| 633 | * token is legal and ready for further use. If it returns false, then |
---|
| 634 | * the scan of the prolog failed and the token is not going to work on |
---|
| 635 | * subsequent scanNext() calls. |
---|
| 636 | * |
---|
| 637 | * @param systemId A pointer to a Unicode string represting the path |
---|
| 638 | * to the XML file to be parsed. |
---|
| 639 | * @param toFill A token maintaing state information to maintain |
---|
| 640 | * internal consistency between invocation of 'parseNext' |
---|
| 641 | * calls. |
---|
| 642 | * |
---|
| 643 | * @return 'true', if successful in parsing the prolog. It indicates the |
---|
| 644 | * user can go ahead with parsing the rest of the file. It |
---|
| 645 | * returns 'false' to indicate that the parser could parse the |
---|
| 646 | * prolog (which means the token will not be valid.) |
---|
| 647 | * |
---|
| 648 | * @see #parseNext |
---|
| 649 | * @see #parseFirst(char*,...) |
---|
| 650 | * @see #parseFirst(InputSource&,...) |
---|
| 651 | */ |
---|
| 652 | virtual bool parseFirst |
---|
| 653 | ( |
---|
| 654 | const XMLCh* const systemId |
---|
| 655 | , XMLPScanToken& toFill |
---|
| 656 | ) ; |
---|
| 657 | |
---|
| 658 | /** Begin a progressive parse operation |
---|
| 659 | * |
---|
| 660 | * This method is used to start a progressive parse on a XML file. |
---|
| 661 | * To continue parsing, subsequent calls must be to the parseNext |
---|
| 662 | * method. |
---|
| 663 | * |
---|
| 664 | * It scans through the prolog and returns a token to be used on |
---|
| 665 | * subsequent scanNext() calls. If the return value is true, then the |
---|
| 666 | * token is legal and ready for further use. If it returns false, then |
---|
| 667 | * the scan of the prolog failed and the token is not going to work on |
---|
| 668 | * subsequent scanNext() calls. |
---|
| 669 | * |
---|
| 670 | * @param systemId A pointer to a regular native string represting |
---|
| 671 | * the path to the XML file to be parsed. |
---|
| 672 | * @param toFill A token maintaing state information to maintain |
---|
| 673 | * internal consIstency between invocation of 'parseNext' |
---|
| 674 | * calls. |
---|
| 675 | * |
---|
| 676 | * @return 'true', if successful in parsing the prolog. It indicates the |
---|
| 677 | * user can go ahead with parsing the rest of the file. It |
---|
| 678 | * returns 'false' to indicate that the parser could not parse |
---|
| 679 | * the prolog. |
---|
| 680 | * |
---|
| 681 | * @see #parseNext |
---|
| 682 | * @see #parseFirst(XMLCh*,...) |
---|
| 683 | * @see #parseFirst(InputSource&,...) |
---|
| 684 | */ |
---|
| 685 | virtual bool parseFirst |
---|
| 686 | ( |
---|
| 687 | const char* const systemId |
---|
| 688 | , XMLPScanToken& toFill |
---|
| 689 | ) ; |
---|
| 690 | |
---|
| 691 | /** Begin a progressive parse operation |
---|
| 692 | * |
---|
| 693 | * This method is used to start a progressive parse on a XML file. |
---|
| 694 | * To continue parsing, subsequent calls must be to the parseNext |
---|
| 695 | * method. |
---|
| 696 | * |
---|
| 697 | * It scans through the prolog and returns a token to be used on |
---|
| 698 | * subsequent scanNext() calls. If the return value is true, then the |
---|
| 699 | * token is legal and ready for further use. If it returns false, then |
---|
| 700 | * the scan of the prolog failed and the token is not going to work on |
---|
| 701 | * subsequent scanNext() calls. |
---|
| 702 | * |
---|
| 703 | * @param source A const reference to the InputSource object which |
---|
| 704 | * points to the XML file to be parsed. |
---|
| 705 | * @param toFill A token maintaing state information to maintain |
---|
| 706 | * internal consistency between invocation of 'parseNext' |
---|
| 707 | * calls. |
---|
| 708 | * |
---|
| 709 | * @return 'true', if successful in parsing the prolog. It indicates the |
---|
| 710 | * user can go ahead with parsing the rest of the file. It |
---|
| 711 | * returns 'false' to indicate that the parser could not parse |
---|
| 712 | * the prolog. |
---|
| 713 | * |
---|
| 714 | * @see #parseNext |
---|
| 715 | * @see #parseFirst(XMLCh*,...) |
---|
| 716 | * @see #parseFirst(char*,...) |
---|
| 717 | */ |
---|
| 718 | virtual bool parseFirst |
---|
| 719 | ( |
---|
| 720 | const InputSource& source |
---|
| 721 | , XMLPScanToken& toFill |
---|
| 722 | ) ; |
---|
| 723 | |
---|
| 724 | /** Continue a progressive parse operation |
---|
| 725 | * |
---|
| 726 | * This method is used to continue with progressive parsing of |
---|
| 727 | * XML files started by a call to 'parseFirst' method. |
---|
| 728 | * |
---|
| 729 | * It parses the XML file and stops as soon as it comes across |
---|
| 730 | * a XML token (as defined in the XML specification). Relevant |
---|
| 731 | * callback handlers are invoked as required by the SAX |
---|
| 732 | * specification. |
---|
| 733 | * |
---|
| 734 | * @param token A token maintaing state information to maintain |
---|
| 735 | * internal consistency between invocation of 'parseNext' |
---|
| 736 | * calls. |
---|
| 737 | * |
---|
| 738 | * @return 'true', if successful in parsing the next XML token. |
---|
| 739 | * It indicates the user can go ahead with parsing the rest |
---|
| 740 | * of the file. It returns 'false' to indicate that the parser |
---|
| 741 | * could not find next token as per the XML specification |
---|
| 742 | * production rule. |
---|
| 743 | * |
---|
| 744 | * @see #parseFirst(XMLCh*,...) |
---|
| 745 | * @see #parseFirst(char*,...) |
---|
| 746 | * @see #parseFirst(InputSource&,...) |
---|
| 747 | */ |
---|
| 748 | virtual bool parseNext(XMLPScanToken& token) ; |
---|
| 749 | |
---|
| 750 | /** Reset the parser after a progressive parse |
---|
| 751 | * |
---|
| 752 | * If a progressive parse loop exits before the end of the document |
---|
| 753 | * is reached, the parser has no way of knowing this. So it will leave |
---|
| 754 | * open any files or sockets or memory buffers that were in use at |
---|
| 755 | * the time that the parse loop exited. |
---|
| 756 | * |
---|
| 757 | * The next parse operation will cause these open files and such to |
---|
| 758 | * be closed, but the next parse operation might occur at some unknown |
---|
| 759 | * future point. To avoid this problem, you should reset the parser if |
---|
| 760 | * you exit the loop early. |
---|
| 761 | * |
---|
| 762 | * If you exited because of an error, then this cleanup will be done |
---|
| 763 | * for you. Its only when you exit the file prematurely of your own |
---|
| 764 | * accord, because you've found what you wanted in the file most |
---|
| 765 | * likely. |
---|
| 766 | * |
---|
| 767 | * @param token A token maintaing state information to maintain |
---|
| 768 | * internal consistency between invocation of 'parseNext' |
---|
| 769 | * calls. |
---|
| 770 | */ |
---|
| 771 | virtual void parseReset(XMLPScanToken& token) ; |
---|
| 772 | |
---|
| 773 | //@} |
---|
| 774 | |
---|
| 775 | // ----------------------------------------------------------------------- |
---|
| 776 | // Implementation of the grammar preparsing interface |
---|
| 777 | // ----------------------------------------------------------------------- |
---|
| 778 | |
---|
| 779 | /** @name Implementation of Grammar preparsing interface's. */ |
---|
| 780 | //@{ |
---|
| 781 | /** |
---|
| 782 | * Preparse schema grammar (XML Schema, DTD, etc.) via an input source |
---|
| 783 | * object. |
---|
| 784 | * |
---|
| 785 | * This method invokes the preparsing process on a schema grammar XML |
---|
| 786 | * file specified by the SAX InputSource parameter. |
---|
| 787 | * |
---|
| 788 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 789 | * |
---|
| 790 | * @param source A const reference to the SAX InputSource object which |
---|
| 791 | * points to the schema grammar file to be preparsed. |
---|
| 792 | * @param grammarType The grammar type (Schema or DTD). |
---|
| 793 | * @param toCache If <code>true</code>, we cache the preparsed grammar, |
---|
| 794 | * otherwise, no chaching. Default is <code>false</code>. |
---|
| 795 | * @return The preparsed schema grammar object (SchemaGrammar or |
---|
| 796 | * DTDGrammar). That grammar object is owned by the parser. |
---|
| 797 | * |
---|
| 798 | * @exception SAXException Any SAX exception, possibly |
---|
| 799 | * wrapping another exception. |
---|
| 800 | * @exception XMLException An exception from the parser or client |
---|
| 801 | * handler code. |
---|
| 802 | * @exception DOMException A DOM exception as per DOM spec. |
---|
| 803 | * |
---|
| 804 | * @see InputSource#InputSource |
---|
| 805 | */ |
---|
| 806 | virtual Grammar* loadGrammar(const InputSource& source, |
---|
| 807 | const short grammarType, |
---|
| 808 | const bool toCache = false); |
---|
| 809 | |
---|
| 810 | /** |
---|
| 811 | * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL |
---|
| 812 | * |
---|
| 813 | * This method invokes the preparsing process on a schema grammar XML |
---|
| 814 | * file specified by the file path parameter. |
---|
| 815 | * |
---|
| 816 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 817 | * |
---|
| 818 | * @param systemId A const XMLCh pointer to the Unicode string which |
---|
| 819 | * contains the path to the XML grammar file to be |
---|
| 820 | * preparsed. |
---|
| 821 | * @param grammarType The grammar type (Schema or DTD). |
---|
| 822 | * @param toCache If <code>true</code>, we cache the preparsed grammar, |
---|
| 823 | * otherwise, no chaching. Default is <code>false</code>. |
---|
| 824 | * @return The preparsed schema grammar object (SchemaGrammar or |
---|
| 825 | * DTDGrammar). That grammar object is owned by the parser. |
---|
| 826 | * |
---|
| 827 | * @exception SAXException Any SAX exception, possibly |
---|
| 828 | * wrapping another exception. |
---|
| 829 | * @exception XMLException An exception from the parser or client |
---|
| 830 | * handler code. |
---|
| 831 | * @exception DOMException A DOM exception as per DOM spec. |
---|
| 832 | */ |
---|
| 833 | virtual Grammar* loadGrammar(const XMLCh* const systemId, |
---|
| 834 | const short grammarType, |
---|
| 835 | const bool toCache = false); |
---|
| 836 | |
---|
| 837 | /** |
---|
| 838 | * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL |
---|
| 839 | * |
---|
| 840 | * This method invokes the preparsing process on a schema grammar XML |
---|
| 841 | * file specified by the file path parameter. |
---|
| 842 | * |
---|
| 843 | * <p><b>"Experimental - subject to change"</b></p> |
---|
| 844 | * |
---|
| 845 | * @param systemId A const char pointer to a native string which contains |
---|
| 846 | * the path to the XML grammar file to be preparsed. |
---|
| 847 | * @param grammarType The grammar type (Schema or DTD). |
---|
| 848 | * @param toCache If <code>true</code>, we cache the preparsed grammar, |
---|
| 849 | * otherwise, no chaching. Default is <code>false</code>. |
---|
| 850 | * @return The preparsed schema grammar object (SchemaGrammar or |
---|
| 851 | * DTDGrammar). That grammar object is owned by the parser. |
---|
| 852 | * |
---|
| 853 | * @exception SAXException Any SAX exception, possibly |
---|
| 854 | * wrapping another exception. |
---|
| 855 | * @exception XMLException An exception from the parser or client |
---|
| 856 | * handler code. |
---|
| 857 | * @exception DOMException A DOM exception as per DOM spec. |
---|
| 858 | */ |
---|
| 859 | virtual Grammar* loadGrammar(const char* const systemId, |
---|
| 860 | const short grammarType, |
---|
| 861 | const bool toCache = false); |
---|
| 862 | |
---|
| 863 | /** |
---|
| 864 | * Clear the cached grammar pool |
---|
| 865 | */ |
---|
| 866 | virtual void resetCachedGrammarPool(); |
---|
| 867 | |
---|
| 868 | /** Set maximum input buffer size |
---|
| 869 | * |
---|
| 870 | * This method allows users to limit the size of buffers used in parsing |
---|
| 871 | * XML character data. The effect of setting this size is to limit the |
---|
| 872 | * size of a ContentHandler::characters() call. |
---|
| 873 | * |
---|
| 874 | * The parser's default input buffer size is 1 megabyte. |
---|
| 875 | * |
---|
| 876 | * @param bufferSize The maximum input buffer size |
---|
| 877 | */ |
---|
| 878 | virtual void setInputBufferSize(const size_t bufferSize); |
---|
| 879 | |
---|
| 880 | //@} |
---|
| 881 | |
---|
| 882 | |
---|
| 883 | // ----------------------------------------------------------------------- |
---|
| 884 | // Advanced document handler list maintenance methods |
---|
| 885 | // ----------------------------------------------------------------------- |
---|
| 886 | |
---|
| 887 | /** @name Advanced document handler list maintenance methods */ |
---|
| 888 | //@{ |
---|
| 889 | /** |
---|
| 890 | * This method installs the specified 'advanced' document callback |
---|
| 891 | * handler, thereby allowing the user to customize the processing, |
---|
| 892 | * if they choose to do so. Any number of advanced callback handlers |
---|
| 893 | * maybe installed. |
---|
| 894 | * |
---|
| 895 | * <p>The methods in the advanced callback interface represent |
---|
| 896 | * Xerces-C extensions. There is no specification for this interface.</p> |
---|
| 897 | * |
---|
| 898 | * @param toInstall A pointer to the users advanced callback handler. |
---|
| 899 | * |
---|
| 900 | * @see #removeAdvDocHandler |
---|
| 901 | */ |
---|
| 902 | virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) ; |
---|
| 903 | |
---|
| 904 | /** |
---|
| 905 | * This method removes the 'advanced' document handler callback from |
---|
| 906 | * the underlying parser scanner. If no handler is installed, advanced |
---|
| 907 | * callbacks are not invoked by the scanner. |
---|
| 908 | * @param toRemove A pointer to the advanced callback handler which |
---|
| 909 | * should be removed. |
---|
| 910 | * |
---|
| 911 | * @see #installAdvDocHandler |
---|
| 912 | */ |
---|
| 913 | virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) ; |
---|
| 914 | //@} |
---|
| 915 | |
---|
| 916 | // ----------------------------------------------------------------------- |
---|
| 917 | // Implementation of the XMLDocumentHandler interface |
---|
| 918 | // ----------------------------------------------------------------------- |
---|
| 919 | /** @name Implementation of the XMLDocumentHandler Interface. */ |
---|
| 920 | //@{ |
---|
| 921 | /** |
---|
| 922 | * This method is used to report all the characters scanned |
---|
| 923 | * by the parser. The driver will invoke the 'characters' |
---|
| 924 | * method of the user installed SAX Document Handler. |
---|
| 925 | * |
---|
| 926 | * <p>If any advanced callback handlers are installed, the |
---|
| 927 | * corresponding 'docCharacters' method will also be invoked.</p> |
---|
| 928 | * |
---|
| 929 | * @param chars A const pointer to a Unicode string representing the |
---|
| 930 | * character data. |
---|
| 931 | * @param length The length of the Unicode string returned in 'chars'. |
---|
| 932 | * @param cdataSection A flag indicating if the characters represent |
---|
| 933 | * content from the CDATA section. |
---|
| 934 | * @see DocumentHandler#characters |
---|
| 935 | */ |
---|
| 936 | virtual void docCharacters |
---|
| 937 | ( |
---|
| 938 | const XMLCh* const chars |
---|
| 939 | , const unsigned int length |
---|
| 940 | , const bool cdataSection |
---|
| 941 | ); |
---|
| 942 | |
---|
| 943 | /** |
---|
| 944 | * This method is used to report any comments scanned by the parser. |
---|
| 945 | * This method is a no-op unless, unless an advanced callback handler |
---|
| 946 | * is installed, in which case the corresponding 'docComment' method |
---|
| 947 | * is invoked. |
---|
| 948 | * |
---|
| 949 | * @param comment A const pointer to a null terminated Unicode |
---|
| 950 | * string representing the comment text. |
---|
| 951 | */ |
---|
| 952 | virtual void docComment |
---|
| 953 | ( |
---|
| 954 | const XMLCh* const comment |
---|
| 955 | ); |
---|
| 956 | |
---|
| 957 | /** |
---|
| 958 | * This method is used to report any PI scanned by the parser. |
---|
| 959 | * |
---|
| 960 | * <p>Any PI's occurring before any 'content' are not reported |
---|
| 961 | * to any SAX handler as per the specification. However, all |
---|
| 962 | * PI's within content are reported via the SAX Document Handler's |
---|
| 963 | * 'processingInstruction' method. |
---|
| 964 | * |
---|
| 965 | * <p>If any advanced callback handlers are installed, the |
---|
| 966 | * corresponding 'docPI' method will be invoked.</p> |
---|
| 967 | * |
---|
| 968 | * @param target A const pointer to a Unicode string representing the |
---|
| 969 | * target of the PI declaration. |
---|
| 970 | * @param data A const pointer to a Unicode string representing the |
---|
| 971 | * data of the PI declaration. See the PI production rule |
---|
| 972 | * in the XML specification for details. |
---|
| 973 | * |
---|
| 974 | * @see DocumentHandler#processingInstruction |
---|
| 975 | */ |
---|
| 976 | virtual void docPI |
---|
| 977 | ( |
---|
| 978 | const XMLCh* const target |
---|
| 979 | , const XMLCh* const data |
---|
| 980 | ); |
---|
| 981 | |
---|
| 982 | /** |
---|
| 983 | * This method is used to indicate the end of root element |
---|
| 984 | * was just scanned by the parser. Corresponding 'endDocument' |
---|
| 985 | * method of the user installed SAX Document Handler will also |
---|
| 986 | * be invoked. |
---|
| 987 | * |
---|
| 988 | * <p>In addition, if any advanced callback handlers are installed, |
---|
| 989 | * the corresponding 'endDocument' method is invoked.</p> |
---|
| 990 | * |
---|
| 991 | * @see DocumentHandler#endDocument |
---|
| 992 | */ |
---|
| 993 | virtual void endDocument(); |
---|
| 994 | |
---|
| 995 | /** |
---|
| 996 | * This method is used to indicate the end tag of an element. |
---|
| 997 | * The driver will invoke the corresponding 'endElement' method of |
---|
| 998 | * the SAX Document Handler interface. |
---|
| 999 | * |
---|
| 1000 | * <p>If any advanced callback handlers are installed, the |
---|
| 1001 | * corresponding 'endElement' method is also invoked.</p> |
---|
| 1002 | * |
---|
| 1003 | * @param elemDecl A const reference to the object containing element |
---|
| 1004 | * declaration information. |
---|
| 1005 | * @param urlId An id referring to the namespace prefix, if |
---|
| 1006 | * namespaces setting is switched on. |
---|
| 1007 | * @param isRoot A flag indicating whether this element was the |
---|
| 1008 | * root element. |
---|
| 1009 | * @param elemPrefix A const pointer to a Unicode string containing |
---|
| 1010 | * the namespace prefix for this element. Applicable |
---|
| 1011 | * only when namespace processing is enabled. |
---|
| 1012 | * @see DocumentHandler#endElement |
---|
| 1013 | */ |
---|
| 1014 | virtual void endElement |
---|
| 1015 | ( |
---|
| 1016 | const XMLElementDecl& elemDecl |
---|
| 1017 | , const unsigned int urlId |
---|
| 1018 | , const bool isRoot |
---|
| 1019 | , const XMLCh* const elemPrefix=0 |
---|
| 1020 | ); |
---|
| 1021 | |
---|
| 1022 | /** |
---|
| 1023 | * This method is used to indicate that an end of an entity reference |
---|
| 1024 | * was just scanned. |
---|
| 1025 | * |
---|
| 1026 | * <p>If any advanced callback handlers are installed, the |
---|
| 1027 | * corresponding 'endEnityReference' method is invoked.</p> |
---|
| 1028 | * |
---|
| 1029 | * @param entDecl A const reference to the object containing the |
---|
| 1030 | * entity declaration information. |
---|
| 1031 | */ |
---|
| 1032 | virtual void endEntityReference |
---|
| 1033 | ( |
---|
| 1034 | const XMLEntityDecl& entDecl |
---|
| 1035 | ); |
---|
| 1036 | |
---|
| 1037 | /** |
---|
| 1038 | * This method is used to report all the whitespace characters, |
---|
| 1039 | * which are determined to be 'ignorable'. This distinction |
---|
| 1040 | * between characters is only made, if validation is enabled. |
---|
| 1041 | * Corresponding 'ignorableWhitespace' method of the user installed |
---|
| 1042 | * SAX Document Handler interface is called. |
---|
| 1043 | * |
---|
| 1044 | * <p>Any whitespace before content is not reported to the SAX |
---|
| 1045 | * Document Handler method, as per the SAX specification. |
---|
| 1046 | * However, if any advanced callback handlers are installed, the |
---|
| 1047 | * corresponding 'ignorableWhitespace' method is invoked.</p> |
---|
| 1048 | * |
---|
| 1049 | * @param chars A const pointer to a Unicode string representing the |
---|
| 1050 | * ignorable whitespace character data. |
---|
| 1051 | * @param length The length of the Unicode string 'chars'. |
---|
| 1052 | * @param cdataSection A flag indicating if the characters represent |
---|
| 1053 | * content from the CDATA section. |
---|
| 1054 | * @see DocumentHandler#ignorableWhitespace |
---|
| 1055 | */ |
---|
| 1056 | virtual void ignorableWhitespace |
---|
| 1057 | ( |
---|
| 1058 | const XMLCh* const chars |
---|
| 1059 | , const unsigned int length |
---|
| 1060 | , const bool cdataSection |
---|
| 1061 | ); |
---|
| 1062 | |
---|
| 1063 | /** |
---|
| 1064 | * This method allows the user installed Document Handler and |
---|
| 1065 | * any advanced callback handlers to 'reset' themselves. |
---|
| 1066 | */ |
---|
| 1067 | virtual void resetDocument(); |
---|
| 1068 | |
---|
| 1069 | /** |
---|
| 1070 | * This method is used to report the start of the parsing process. |
---|
| 1071 | * The corresponding user installed SAX Document Handler's method |
---|
| 1072 | * 'startDocument' is invoked. |
---|
| 1073 | * |
---|
| 1074 | * <p>If any advanced callback handlers are installed, then the |
---|
| 1075 | * corresponding 'startDocument' method is also called.</p> |
---|
| 1076 | * |
---|
| 1077 | * @see DocumentHandler#startDocument |
---|
| 1078 | */ |
---|
| 1079 | virtual void startDocument(); |
---|
| 1080 | |
---|
| 1081 | /** |
---|
| 1082 | * This method is used to report the start of an element. It is |
---|
| 1083 | * called at the end of the element, by which time all attributes |
---|
| 1084 | * specified are also parsed. The corresponding user installed |
---|
| 1085 | * SAX Document Handler's method 'startElement' is invoked. |
---|
| 1086 | * |
---|
| 1087 | * <p>If any advanced callback handlers are installed, then the |
---|
| 1088 | * corresponding 'startElement' method is also called.</p> |
---|
| 1089 | * |
---|
| 1090 | * @param elemDecl A const reference to the object containing element |
---|
| 1091 | * declaration information. |
---|
| 1092 | * @param urlId An id referring to the namespace prefix, if |
---|
| 1093 | * namespaces setting is switched on. |
---|
| 1094 | * @param elemPrefix A const pointer to a Unicode string containing |
---|
| 1095 | * the namespace prefix for this element. Applicable |
---|
| 1096 | * only when namespace processing is enabled. |
---|
| 1097 | * @param attrList A const reference to the object containing the |
---|
| 1098 | * list of attributes just scanned for this element. |
---|
| 1099 | * @param attrCount A count of number of attributes in the list |
---|
| 1100 | * specified by the parameter 'attrList'. |
---|
| 1101 | * @param isEmpty A flag indicating whether this is an empty element |
---|
| 1102 | * or not. |
---|
| 1103 | * @param isRoot A flag indicating whether this element was the |
---|
| 1104 | * root element. |
---|
| 1105 | * @see DocumentHandler#startElement |
---|
| 1106 | */ |
---|
| 1107 | virtual void startElement |
---|
| 1108 | ( |
---|
| 1109 | const XMLElementDecl& elemDecl |
---|
| 1110 | , const unsigned int urlId |
---|
| 1111 | , const XMLCh* const elemPrefix |
---|
| 1112 | , const RefVectorOf<XMLAttr>& attrList |
---|
| 1113 | , const unsigned int attrCount |
---|
| 1114 | , const bool isEmpty |
---|
| 1115 | , const bool isRoot |
---|
| 1116 | ); |
---|
| 1117 | |
---|
| 1118 | /** |
---|
| 1119 | * This method is used to indicate the start of an entity reference. |
---|
| 1120 | * |
---|
| 1121 | * <p>If any advanced callback handlers are installed, the |
---|
| 1122 | * corresponding 'endEnityReference' method is invoked.</p> |
---|
| 1123 | * |
---|
| 1124 | * @param entDecl A const reference to the object containing the |
---|
| 1125 | * entity declaration information. |
---|
| 1126 | */ |
---|
| 1127 | virtual void startEntityReference |
---|
| 1128 | ( |
---|
| 1129 | const XMLEntityDecl& entDecl |
---|
| 1130 | ); |
---|
| 1131 | |
---|
| 1132 | /** |
---|
| 1133 | * This method is used to report the XML decl scanned by the parser. |
---|
| 1134 | * Refer to the XML specification to see the meaning of parameters. |
---|
| 1135 | * |
---|
| 1136 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1137 | * implementation.</font></b> |
---|
| 1138 | * |
---|
| 1139 | * @param versionStr A const pointer to a Unicode string representing |
---|
| 1140 | * version string value. |
---|
| 1141 | * @param encodingStr A const pointer to a Unicode string representing |
---|
| 1142 | * the encoding string value. |
---|
| 1143 | * @param standaloneStr A const pointer to a Unicode string |
---|
| 1144 | * representing the standalone string value. |
---|
| 1145 | * @param actualEncodingStr A const pointer to a Unicode string |
---|
| 1146 | * representing the actual encoding string |
---|
| 1147 | * value. |
---|
| 1148 | */ |
---|
| 1149 | virtual void XMLDecl |
---|
| 1150 | ( |
---|
| 1151 | const XMLCh* const versionStr |
---|
| 1152 | , const XMLCh* const encodingStr |
---|
| 1153 | , const XMLCh* const standaloneStr |
---|
| 1154 | , const XMLCh* const actualEncodingStr |
---|
| 1155 | ); |
---|
| 1156 | //@} |
---|
| 1157 | |
---|
| 1158 | |
---|
| 1159 | // ----------------------------------------------------------------------- |
---|
| 1160 | // Implementation of the XMLErrorReporter interface |
---|
| 1161 | // ----------------------------------------------------------------------- |
---|
| 1162 | |
---|
| 1163 | /** @name Implementation of the XMLErrorReporter Interface. */ |
---|
| 1164 | //@{ |
---|
| 1165 | /** |
---|
| 1166 | * This method is used to report back errors found while parsing the |
---|
| 1167 | * XML file. The driver will call the corresponding user installed |
---|
| 1168 | * SAX Error Handler methods: 'fatal', 'error', 'warning' depending |
---|
| 1169 | * on the severity of the error. This classification is defined by |
---|
| 1170 | * the XML specification. |
---|
| 1171 | * |
---|
| 1172 | * @param errCode An integer code for the error. |
---|
| 1173 | * @param msgDomain A const pointer to an Unicode string representing |
---|
| 1174 | * the message domain to use. |
---|
| 1175 | * @param errType An enumeration classifying the severity of the error. |
---|
| 1176 | * @param errorText A const pointer to an Unicode string representing |
---|
| 1177 | * the text of the error message. |
---|
| 1178 | * @param systemId A const pointer to an Unicode string representing |
---|
| 1179 | * the system id of the XML file where this error |
---|
| 1180 | * was discovered. |
---|
| 1181 | * @param publicId A const pointer to an Unicode string representing |
---|
| 1182 | * the public id of the XML file where this error |
---|
| 1183 | * was discovered. |
---|
| 1184 | * @param lineNum The line number where the error occurred. |
---|
| 1185 | * @param colNum The column number where the error occurred. |
---|
| 1186 | * @see ErrorHandler |
---|
| 1187 | */ |
---|
| 1188 | virtual void error |
---|
| 1189 | ( |
---|
| 1190 | const unsigned int errCode |
---|
| 1191 | , const XMLCh* const msgDomain |
---|
| 1192 | , const XMLErrorReporter::ErrTypes errType |
---|
| 1193 | , const XMLCh* const errorText |
---|
| 1194 | , const XMLCh* const systemId |
---|
| 1195 | , const XMLCh* const publicId |
---|
| 1196 | , const XMLSSize_t lineNum |
---|
| 1197 | , const XMLSSize_t colNum |
---|
| 1198 | ); |
---|
| 1199 | |
---|
| 1200 | /** |
---|
| 1201 | * This method allows the user installed Error Handler |
---|
| 1202 | * callback to 'reset' itself. |
---|
| 1203 | * |
---|
| 1204 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1205 | * implementation.</font></b> |
---|
| 1206 | * |
---|
| 1207 | */ |
---|
| 1208 | virtual void resetErrors(); |
---|
| 1209 | //@} |
---|
| 1210 | |
---|
| 1211 | |
---|
| 1212 | // ----------------------------------------------------------------------- |
---|
| 1213 | // Implementation of the XMLEntityHandler interface |
---|
| 1214 | // ----------------------------------------------------------------------- |
---|
| 1215 | |
---|
| 1216 | /** @name Implementation of the XMLEntityHandler Interface. */ |
---|
| 1217 | //@{ |
---|
| 1218 | /** |
---|
| 1219 | * This method is used to indicate the end of parsing of an external |
---|
| 1220 | * entity file. |
---|
| 1221 | * |
---|
| 1222 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1223 | * implementation.</font></b> |
---|
| 1224 | * |
---|
| 1225 | * @param inputSource A const reference to the InputSource object |
---|
| 1226 | * which points to the XML file being parsed. |
---|
| 1227 | * @see InputSource |
---|
| 1228 | */ |
---|
| 1229 | virtual void endInputSource(const InputSource& inputSource); |
---|
| 1230 | |
---|
| 1231 | /** |
---|
| 1232 | * This method allows an installed XMLEntityHandler to further |
---|
| 1233 | * process any system id's of enternal entities encountered in |
---|
| 1234 | * the XML file being parsed, such as redirection etc. |
---|
| 1235 | * |
---|
| 1236 | * <b><font color="#FF0000">This method always returns 'false' |
---|
| 1237 | * for this SAX driver implementation.</font></b> |
---|
| 1238 | * |
---|
| 1239 | * @param systemId A const pointer to an Unicode string representing |
---|
| 1240 | * the system id scanned by the parser. |
---|
| 1241 | * @param toFill A pointer to a buffer in which the application |
---|
| 1242 | * processed system id is stored. |
---|
| 1243 | * @return 'true', if any processing is done, 'false' otherwise. |
---|
| 1244 | */ |
---|
| 1245 | virtual bool expandSystemId |
---|
| 1246 | ( |
---|
| 1247 | const XMLCh* const systemId |
---|
| 1248 | , XMLBuffer& toFill |
---|
| 1249 | ); |
---|
| 1250 | |
---|
| 1251 | /** |
---|
| 1252 | * This method allows the installed XMLEntityHandler to reset |
---|
| 1253 | * itself. |
---|
| 1254 | * |
---|
| 1255 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1256 | * implementation.</font></b> |
---|
| 1257 | */ |
---|
| 1258 | virtual void resetEntities(); |
---|
| 1259 | |
---|
| 1260 | /** |
---|
| 1261 | * This method allows a user installed entity handler to further |
---|
| 1262 | * process any pointers to external entities. The applications |
---|
| 1263 | * can implement 'redirection' via this callback. The driver |
---|
| 1264 | * should call the SAX EntityHandler 'resolveEntity' method. |
---|
| 1265 | * |
---|
| 1266 | * @deprecated This method is no longer called (the other resolveEntity one is). |
---|
| 1267 | * |
---|
| 1268 | * @param publicId A const pointer to a Unicode string representing the |
---|
| 1269 | * public id of the entity just parsed. |
---|
| 1270 | * @param systemId A const pointer to a Unicode string representing the |
---|
| 1271 | * system id of the entity just parsed. |
---|
| 1272 | * @param baseURI A const pointer to a Unicode string representing the |
---|
| 1273 | * base URI of the entity just parsed, |
---|
| 1274 | * or <code>null</code> if there is no base URI. |
---|
| 1275 | * @return The value returned by the SAX resolveEntity method or |
---|
| 1276 | * NULL otherwise to indicate no processing was done. |
---|
| 1277 | * The returned InputSource is owned by the parser which is |
---|
| 1278 | * responsible to clean up the memory. |
---|
| 1279 | * @see EntityResolver |
---|
| 1280 | * @see XMLEntityHandler |
---|
| 1281 | */ |
---|
| 1282 | virtual InputSource* resolveEntity |
---|
| 1283 | ( |
---|
| 1284 | const XMLCh* const publicId |
---|
| 1285 | , const XMLCh* const systemId |
---|
| 1286 | , const XMLCh* const baseURI = 0 |
---|
| 1287 | ); |
---|
| 1288 | |
---|
| 1289 | /** Resolve a public/system id |
---|
| 1290 | * |
---|
| 1291 | * This method allows a user installed entity handler to further |
---|
| 1292 | * process any pointers to external entities. The applications can |
---|
| 1293 | * implement 'redirection' via this callback. |
---|
| 1294 | * |
---|
| 1295 | * @param resourceIdentifier An object containing the type of |
---|
| 1296 | * resource to be resolved and the associated data members |
---|
| 1297 | * corresponding to this type. |
---|
| 1298 | * @return The value returned by the user installed resolveEntity |
---|
| 1299 | * method or NULL otherwise to indicate no processing was done. |
---|
| 1300 | * The returned InputSource is owned by the parser which is |
---|
| 1301 | * responsible to clean up the memory. |
---|
| 1302 | * @see XMLEntityHandler |
---|
| 1303 | * @see XMLEntityResolver |
---|
| 1304 | */ |
---|
| 1305 | virtual InputSource* resolveEntity |
---|
| 1306 | ( |
---|
| 1307 | XMLResourceIdentifier* resourceIdentifier |
---|
| 1308 | ); |
---|
| 1309 | |
---|
| 1310 | /** |
---|
| 1311 | * This method is used to indicate the start of parsing an |
---|
| 1312 | * external entity file. |
---|
| 1313 | * |
---|
| 1314 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1315 | * implementation.</font></b> |
---|
| 1316 | * |
---|
| 1317 | * @param inputSource A const reference to the InputSource object |
---|
| 1318 | * which points to the external entity |
---|
| 1319 | * being parsed. |
---|
| 1320 | */ |
---|
| 1321 | virtual void startInputSource(const InputSource& inputSource); |
---|
| 1322 | //@} |
---|
| 1323 | |
---|
| 1324 | // ----------------------------------------------------------------------- |
---|
| 1325 | // Implementation of the Deprecated DocTypeHandler Interface |
---|
| 1326 | // ----------------------------------------------------------------------- |
---|
| 1327 | |
---|
| 1328 | /** @name Implementation of the deprecated DocTypeHandler Interface */ |
---|
| 1329 | //@{ |
---|
| 1330 | /** |
---|
| 1331 | * This method is used to report an attribute definition. |
---|
| 1332 | * |
---|
| 1333 | * <b><font color="#FF0000">This method is a no-op for this SAX |
---|
| 1334 | * driver implementation.</font></b> |
---|
| 1335 | * |
---|
| 1336 | * @param elemDecl A const reference to the object containing information |
---|
| 1337 | * about the element whose attribute definition was just |
---|
| 1338 | * parsed. |
---|
| 1339 | * @param attDef A const reference to the object containing information |
---|
| 1340 | * attribute definition. |
---|
| 1341 | * @param ignore The flag indicating whether this attribute definition |
---|
| 1342 | * was ignored by the parser or not. |
---|
| 1343 | */ |
---|
| 1344 | virtual void attDef |
---|
| 1345 | ( |
---|
| 1346 | const DTDElementDecl& elemDecl |
---|
| 1347 | , const DTDAttDef& attDef |
---|
| 1348 | , const bool ignoring |
---|
| 1349 | ); |
---|
| 1350 | |
---|
| 1351 | /** |
---|
| 1352 | * This method is used to report a comment occurring within the DTD. |
---|
| 1353 | * |
---|
| 1354 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1355 | * implementation.</font></b> |
---|
| 1356 | * |
---|
| 1357 | * @param comment A const pointer to a Unicode string representing the |
---|
| 1358 | * text of the comment just parsed. |
---|
| 1359 | */ |
---|
| 1360 | virtual void doctypeComment |
---|
| 1361 | ( |
---|
| 1362 | const XMLCh* const comment |
---|
| 1363 | ); |
---|
| 1364 | |
---|
| 1365 | /** |
---|
| 1366 | * This method is used to report the DOCTYPE declaration. |
---|
| 1367 | * |
---|
| 1368 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1369 | * implementation.</font></b> |
---|
| 1370 | * |
---|
| 1371 | * @param elemDecl A const reference to the object containing information |
---|
| 1372 | * about the root element definition declaration of the |
---|
| 1373 | * XML document being parsed. |
---|
| 1374 | * @param publicId A const pointer to a Unicode string representing the |
---|
| 1375 | * public id of the DTD file. |
---|
| 1376 | * @param systemId A const pointer to a Unicode string representing the |
---|
| 1377 | * system id of the DTD file. |
---|
| 1378 | * @param hasIntSubset A flag indicating if this XML file contains any |
---|
| 1379 | * internal subset. |
---|
| 1380 | * @param hasExtSubset A flag indicating if this XML file contains any |
---|
| 1381 | * external subset. Default is false. |
---|
| 1382 | */ |
---|
| 1383 | virtual void doctypeDecl |
---|
| 1384 | ( |
---|
| 1385 | const DTDElementDecl& elemDecl |
---|
| 1386 | , const XMLCh* const publicId |
---|
| 1387 | , const XMLCh* const systemId |
---|
| 1388 | , const bool hasIntSubset |
---|
| 1389 | , const bool hasExtSubset = false |
---|
| 1390 | ); |
---|
| 1391 | |
---|
| 1392 | /** |
---|
| 1393 | * This method is used to report any PI declarations |
---|
| 1394 | * occurring inside the DTD definition block. |
---|
| 1395 | * |
---|
| 1396 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1397 | * implementation.</font></b> |
---|
| 1398 | * |
---|
| 1399 | * @param target A const pointer to a Unicode string representing the |
---|
| 1400 | * target of the PI declaration. |
---|
| 1401 | * @param data A const pointer to a Unicode string representing the |
---|
| 1402 | * data of the PI declaration. See the PI production rule |
---|
| 1403 | * in the XML specification for details. |
---|
| 1404 | */ |
---|
| 1405 | virtual void doctypePI |
---|
| 1406 | ( |
---|
| 1407 | const XMLCh* const target |
---|
| 1408 | , const XMLCh* const data |
---|
| 1409 | ); |
---|
| 1410 | |
---|
| 1411 | /** |
---|
| 1412 | * This method is used to report any whitespaces |
---|
| 1413 | * occurring inside the DTD definition block. |
---|
| 1414 | * |
---|
| 1415 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1416 | * implementation.</font></b> |
---|
| 1417 | * |
---|
| 1418 | * @param chars A const pointer to a Unicode string representing the |
---|
| 1419 | * whitespace characters. |
---|
| 1420 | * @param length The length of the whitespace Unicode string. |
---|
| 1421 | */ |
---|
| 1422 | virtual void doctypeWhitespace |
---|
| 1423 | ( |
---|
| 1424 | const XMLCh* const chars |
---|
| 1425 | , const unsigned int length |
---|
| 1426 | ); |
---|
| 1427 | |
---|
| 1428 | /** |
---|
| 1429 | * This method is used to report an element declarations |
---|
| 1430 | * successfully scanned by the parser. |
---|
| 1431 | * |
---|
| 1432 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1433 | * implementation.</font></b> |
---|
| 1434 | * |
---|
| 1435 | * @param decl A const reference to the object containing element |
---|
| 1436 | * declaration information. |
---|
| 1437 | * @param isIgnored The flag indicating whether this definition was |
---|
| 1438 | * ignored by the parser or not. |
---|
| 1439 | */ |
---|
| 1440 | virtual void elementDecl |
---|
| 1441 | ( |
---|
| 1442 | const DTDElementDecl& decl |
---|
| 1443 | , const bool isIgnored |
---|
| 1444 | ); |
---|
| 1445 | |
---|
| 1446 | /** |
---|
| 1447 | * This method is used to report the end of an attribute |
---|
| 1448 | * list declaration for an element. |
---|
| 1449 | * |
---|
| 1450 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1451 | * implementation.</font></b> |
---|
| 1452 | * |
---|
| 1453 | * @param elemDecl A const reference to the object containing element |
---|
| 1454 | * declaration information. |
---|
| 1455 | */ |
---|
| 1456 | virtual void endAttList |
---|
| 1457 | ( |
---|
| 1458 | const DTDElementDecl& elemDecl |
---|
| 1459 | ); |
---|
| 1460 | |
---|
| 1461 | /** |
---|
| 1462 | * This method is used to report the end of the internal subset. |
---|
| 1463 | * |
---|
| 1464 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1465 | * implementation.</font></b> |
---|
| 1466 | */ |
---|
| 1467 | virtual void endIntSubset(); |
---|
| 1468 | |
---|
| 1469 | /** |
---|
| 1470 | * This method is used to report the end of the external subset. |
---|
| 1471 | * |
---|
| 1472 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1473 | * implementation.</font></b> |
---|
| 1474 | */ |
---|
| 1475 | virtual void endExtSubset(); |
---|
| 1476 | |
---|
| 1477 | /** |
---|
| 1478 | * This method is used to report any entity declarations. |
---|
| 1479 | * For unparsed entities, this driver will invoke the |
---|
| 1480 | * SAX DTDHandler::unparsedEntityDecl callback. |
---|
| 1481 | * |
---|
| 1482 | * @param entityDecl A const reference to the object containing |
---|
| 1483 | * the entity declaration information. |
---|
| 1484 | * @param isPEDecl The flag indicating whether this was a |
---|
| 1485 | * parameter entity declaration or not. |
---|
| 1486 | * @param isIgnored The flag indicating whether this definition |
---|
| 1487 | * was ignored by the parser or not. |
---|
| 1488 | * |
---|
| 1489 | * @see DTDHandler#unparsedEntityDecl |
---|
| 1490 | */ |
---|
| 1491 | virtual void entityDecl |
---|
| 1492 | ( |
---|
| 1493 | const DTDEntityDecl& entityDecl |
---|
| 1494 | , const bool isPEDecl |
---|
| 1495 | , const bool isIgnored |
---|
| 1496 | ); |
---|
| 1497 | |
---|
| 1498 | /** |
---|
| 1499 | * This method allows the user installed DTD handler to |
---|
| 1500 | * reset itself. |
---|
| 1501 | */ |
---|
| 1502 | virtual void resetDocType(); |
---|
| 1503 | |
---|
| 1504 | /** |
---|
| 1505 | * This method is used to report any notation declarations. |
---|
| 1506 | * If there is a user installed DTDHandler, then the driver will |
---|
| 1507 | * invoke the SAX DTDHandler::notationDecl callback. |
---|
| 1508 | * |
---|
| 1509 | * @param notDecl A const reference to the object containing the notation |
---|
| 1510 | * declaration information. |
---|
| 1511 | * @param isIgnored The flag indicating whether this definition was ignored |
---|
| 1512 | * by the parser or not. |
---|
| 1513 | * |
---|
| 1514 | * @see DTDHandler#notationDecl |
---|
| 1515 | */ |
---|
| 1516 | virtual void notationDecl |
---|
| 1517 | ( |
---|
| 1518 | const XMLNotationDecl& notDecl |
---|
| 1519 | , const bool isIgnored |
---|
| 1520 | ); |
---|
| 1521 | |
---|
| 1522 | /** |
---|
| 1523 | * This method is used to indicate the start of an element's attribute |
---|
| 1524 | * list declaration. |
---|
| 1525 | * |
---|
| 1526 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1527 | * implementation.</font></b> |
---|
| 1528 | * |
---|
| 1529 | * @param elemDecl A const reference to the object containing element |
---|
| 1530 | * declaration information. |
---|
| 1531 | */ |
---|
| 1532 | virtual void startAttList |
---|
| 1533 | ( |
---|
| 1534 | const DTDElementDecl& elemDecl |
---|
| 1535 | ); |
---|
| 1536 | |
---|
| 1537 | /** |
---|
| 1538 | * This method is used indicate the start of the internal subset. |
---|
| 1539 | * |
---|
| 1540 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1541 | * implementation.</font></b> |
---|
| 1542 | */ |
---|
| 1543 | virtual void startIntSubset(); |
---|
| 1544 | |
---|
| 1545 | /** |
---|
| 1546 | * This method is used indicate the start of the external subset. |
---|
| 1547 | * |
---|
| 1548 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1549 | * implementation.</font></b> |
---|
| 1550 | */ |
---|
| 1551 | virtual void startExtSubset(); |
---|
| 1552 | |
---|
| 1553 | /** |
---|
| 1554 | * This method is used to report the TextDecl. Refer to the XML |
---|
| 1555 | * specification for the syntax of a TextDecl. |
---|
| 1556 | * |
---|
| 1557 | * <b><font color="#FF0000">This method is a no-op for this SAX driver |
---|
| 1558 | * implementation.</font></b> |
---|
| 1559 | * |
---|
| 1560 | * @param versionStr A const pointer to a Unicode string representing |
---|
| 1561 | * the version number of the 'version' clause. |
---|
| 1562 | * @param encodingStr A const pointer to a Unicode string representing |
---|
| 1563 | * the encoding name of the 'encoding' clause. |
---|
| 1564 | */ |
---|
| 1565 | virtual void TextDecl |
---|
| 1566 | ( |
---|
| 1567 | const XMLCh* const versionStr |
---|
| 1568 | , const XMLCh* const encodingStr |
---|
| 1569 | ); |
---|
| 1570 | //@} |
---|
| 1571 | |
---|
| 1572 | |
---|
| 1573 | private : |
---|
| 1574 | // ----------------------------------------------------------------------- |
---|
| 1575 | // Unimplemented constructors and operators |
---|
| 1576 | // ----------------------------------------------------------------------- |
---|
| 1577 | SAX2XMLReaderImpl(const SAX2XMLReaderImpl&); |
---|
| 1578 | SAX2XMLReaderImpl& operator=(const SAX2XMLReaderImpl&); |
---|
| 1579 | |
---|
| 1580 | // ----------------------------------------------------------------------- |
---|
| 1581 | // Initialize/Cleanup methods |
---|
| 1582 | // ----------------------------------------------------------------------- |
---|
| 1583 | void initialize(); |
---|
| 1584 | void cleanUp(); |
---|
| 1585 | void resetInProgress(); |
---|
| 1586 | |
---|
| 1587 | // ----------------------------------------------------------------------- |
---|
| 1588 | // Private data members |
---|
| 1589 | // |
---|
| 1590 | // fAttrList |
---|
| 1591 | // A temporary implementation of the basic SAX2 Attributes |
---|
| 1592 | // interface. We use this one over and over on each startElement |
---|
| 1593 | // event to allow SAX-like access to the element attributes. |
---|
| 1594 | // |
---|
| 1595 | // fDocHandler |
---|
| 1596 | // The installed SAX content handler, if any. Null if none. |
---|
| 1597 | // |
---|
| 1598 | // fnamespacePrefix |
---|
| 1599 | // Indicates whether the namespace-prefix feature is on or off. |
---|
| 1600 | // |
---|
| 1601 | // fautoValidation |
---|
| 1602 | // Indicates whether automatic validation is on or off |
---|
| 1603 | // |
---|
| 1604 | // fValidation |
---|
| 1605 | // Indicates whether the 'validation' core features is on or off |
---|
| 1606 | // |
---|
| 1607 | // fReuseGrammar |
---|
| 1608 | // Tells the parser whether it should reuse the grammar or not. |
---|
| 1609 | // If true, there cannot be any internal subset. |
---|
| 1610 | // |
---|
| 1611 | // fPrefixesStorage |
---|
| 1612 | // the namespace prefixes will be allocated from this pool |
---|
| 1613 | // |
---|
| 1614 | // fPrefixes |
---|
| 1615 | // A Stack of the current namespace prefixes that need calls to |
---|
| 1616 | // endPrefixMapping |
---|
| 1617 | // |
---|
| 1618 | // fPrefixCounts |
---|
| 1619 | // A Stack of the number of prefixes that need endPrefixMapping |
---|
| 1620 | // calls for that element |
---|
| 1621 | // |
---|
| 1622 | // fDTDHandler |
---|
| 1623 | // The installed SAX DTD handler, if any. Null if none. |
---|
| 1624 | // |
---|
| 1625 | // fElemDepth |
---|
| 1626 | // This is used to track the element nesting depth, so that we can |
---|
| 1627 | // know when we are inside content. This is so we can ignore char |
---|
| 1628 | // data outside of content. |
---|
| 1629 | // |
---|
| 1630 | // fEntityResolver |
---|
| 1631 | // The installed SAX entity handler, if any. Null if none. |
---|
| 1632 | // |
---|
| 1633 | // fErrorHandler |
---|
| 1634 | // The installed SAX error handler, if any. Null if none. |
---|
| 1635 | // |
---|
| 1636 | // fLexicalHandler |
---|
| 1637 | // The installed SAX lexical handler, if any. Null if none. |
---|
| 1638 | // |
---|
| 1639 | // fDecllHandler |
---|
| 1640 | // The installed SAX declaration handler, if any. Null if none. |
---|
| 1641 | // |
---|
| 1642 | // fAdvDHCount |
---|
| 1643 | // fAdvDHList |
---|
| 1644 | // fAdvDHListSize |
---|
| 1645 | // This is an array of pointers to XMLDocumentHandlers, which is |
---|
| 1646 | // how we see installed advanced document handlers. There will |
---|
| 1647 | // usually not be very many at all, so a simple array is used |
---|
| 1648 | // instead of a collection, for performance. It will grow if needed, |
---|
| 1649 | // but that is unlikely. |
---|
| 1650 | // |
---|
| 1651 | // The count is how many handlers are currently installed. The size |
---|
| 1652 | // is how big the array itself is (for expansion purposes.) When |
---|
| 1653 | // count == size, is time to expand. |
---|
| 1654 | // |
---|
| 1655 | // fParseInProgress |
---|
| 1656 | // This flag is set once a parse starts. It is used to prevent |
---|
| 1657 | // multiple entrance or reentrance of the parser. |
---|
| 1658 | // |
---|
| 1659 | // fScanner |
---|
| 1660 | // The scanner being used by this parser. It is created internally |
---|
| 1661 | // during construction. |
---|
| 1662 | // |
---|
| 1663 | // fHasExternalSubset |
---|
| 1664 | // Indicate if the document has external DTD subset. |
---|
| 1665 | // |
---|
| 1666 | // fGrammarPool |
---|
| 1667 | // The grammar pool passed from external application (through derivatives). |
---|
| 1668 | // which could be 0, not owned. |
---|
| 1669 | // |
---|
| 1670 | // ----------------------------------------------------------------------- |
---|
| 1671 | bool fNamespacePrefix; |
---|
| 1672 | bool fAutoValidation; |
---|
| 1673 | bool fValidation; |
---|
| 1674 | bool fParseInProgress; |
---|
| 1675 | bool fHasExternalSubset; |
---|
| 1676 | unsigned int fElemDepth; |
---|
| 1677 | unsigned int fAdvDHCount; |
---|
| 1678 | unsigned int fAdvDHListSize; |
---|
| 1679 | VecAttributesImpl fAttrList ; |
---|
| 1680 | ContentHandler* fDocHandler ; |
---|
| 1681 | RefVectorOf<XMLAttr>* fTempAttrVec ; |
---|
| 1682 | XMLStringPool* fPrefixesStorage ; |
---|
| 1683 | ValueStackOf<unsigned int>* fPrefixes ; |
---|
| 1684 | ValueStackOf<unsigned int>* fPrefixCounts ; |
---|
| 1685 | DTDHandler* fDTDHandler; |
---|
| 1686 | EntityResolver* fEntityResolver; |
---|
| 1687 | XMLEntityResolver* fXMLEntityResolver; |
---|
| 1688 | ErrorHandler* fErrorHandler; |
---|
| 1689 | PSVIHandler* fPSVIHandler; |
---|
| 1690 | LexicalHandler* fLexicalHandler; |
---|
| 1691 | DeclHandler* fDeclHandler; |
---|
| 1692 | XMLDocumentHandler** fAdvDHList; |
---|
| 1693 | XMLScanner* fScanner; |
---|
| 1694 | GrammarResolver* fGrammarResolver; |
---|
| 1695 | XMLStringPool* fURIStringPool; |
---|
| 1696 | XMLValidator* fValidator; |
---|
| 1697 | MemoryManager* fMemoryManager; |
---|
| 1698 | XMLGrammarPool* fGrammarPool; |
---|
| 1699 | |
---|
| 1700 | // ----------------------------------------------------------------------- |
---|
| 1701 | // internal function used to set the state of the parser |
---|
| 1702 | // ----------------------------------------------------------------------- |
---|
| 1703 | void setValidationScheme(const ValSchemes newScheme); |
---|
| 1704 | void setDoNamespaces(const bool newState); |
---|
| 1705 | bool getDoNamespaces() const; |
---|
| 1706 | void setDoSchema(const bool newState); |
---|
| 1707 | bool getDoSchema() const; |
---|
| 1708 | }; |
---|
| 1709 | |
---|
| 1710 | |
---|
| 1711 | // --------------------------------------------------------------------------- |
---|
| 1712 | // SAX2XMLReader: Getter methods |
---|
| 1713 | // --------------------------------------------------------------------------- |
---|
| 1714 | inline ContentHandler* SAX2XMLReaderImpl::getContentHandler() const |
---|
| 1715 | { |
---|
| 1716 | return fDocHandler; |
---|
| 1717 | } |
---|
| 1718 | |
---|
| 1719 | inline DTDHandler* SAX2XMLReaderImpl::getDTDHandler() const |
---|
| 1720 | { |
---|
| 1721 | return fDTDHandler ; |
---|
| 1722 | } |
---|
| 1723 | |
---|
| 1724 | inline EntityResolver* SAX2XMLReaderImpl::getEntityResolver() const |
---|
| 1725 | { |
---|
| 1726 | return fEntityResolver; |
---|
| 1727 | } |
---|
| 1728 | |
---|
| 1729 | inline XMLEntityResolver* SAX2XMLReaderImpl::getXMLEntityResolver() const |
---|
| 1730 | { |
---|
| 1731 | return fXMLEntityResolver; |
---|
| 1732 | } |
---|
| 1733 | |
---|
| 1734 | inline ErrorHandler* SAX2XMLReaderImpl::getErrorHandler() const |
---|
| 1735 | { |
---|
| 1736 | return fErrorHandler; |
---|
| 1737 | } |
---|
| 1738 | |
---|
| 1739 | inline PSVIHandler* SAX2XMLReaderImpl::getPSVIHandler() const |
---|
| 1740 | { |
---|
| 1741 | return fPSVIHandler; |
---|
| 1742 | } |
---|
| 1743 | |
---|
| 1744 | inline LexicalHandler* SAX2XMLReaderImpl::getLexicalHandler() const |
---|
| 1745 | { |
---|
| 1746 | return fLexicalHandler; |
---|
| 1747 | } |
---|
| 1748 | |
---|
| 1749 | inline DeclHandler* SAX2XMLReaderImpl::getDeclarationHandler() const |
---|
| 1750 | { |
---|
| 1751 | return fDeclHandler; |
---|
| 1752 | } |
---|
| 1753 | |
---|
| 1754 | inline bool SAX2XMLReaderImpl::getExitOnFirstFatalError() const |
---|
| 1755 | { |
---|
| 1756 | return fScanner->getExitOnFirstFatal(); |
---|
| 1757 | } |
---|
| 1758 | |
---|
| 1759 | inline bool SAX2XMLReaderImpl::getValidationConstraintFatal() const |
---|
| 1760 | { |
---|
| 1761 | return fScanner->getValidationConstraintFatal(); |
---|
| 1762 | } |
---|
| 1763 | |
---|
| 1764 | inline Grammar* SAX2XMLReaderImpl::getRootGrammar() |
---|
| 1765 | { |
---|
| 1766 | return fScanner->getRootGrammar(); |
---|
| 1767 | } |
---|
| 1768 | |
---|
| 1769 | inline const XMLCh* SAX2XMLReaderImpl::getURIText(unsigned int uriId) const |
---|
| 1770 | { |
---|
| 1771 | return fScanner->getURIText(uriId); |
---|
| 1772 | } |
---|
| 1773 | |
---|
| 1774 | inline unsigned int SAX2XMLReaderImpl::getSrcOffset() const |
---|
| 1775 | { |
---|
| 1776 | return fScanner->getSrcOffset(); |
---|
| 1777 | } |
---|
| 1778 | |
---|
| 1779 | XERCES_CPP_NAMESPACE_END |
---|
| 1780 | |
---|
| 1781 | #endif |
---|