[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2001 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: SAX2XMLReader.hpp,v $
|
---|
| 59 | * Revision 1.10 2003/03/07 18:10:30 tng
|
---|
| 60 | * Return a reference instead of void for operator=
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.9 2003/01/09 19:07:27 tng
|
---|
| 63 | * [Bug 15802] Add "const" qualifier to getURIText.
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.8 2002/12/23 15:23:18 knoaman
|
---|
| 66 | * Added a public api to various parsers to return the src offset within the input
|
---|
| 67 | * source.
|
---|
| 68 | *
|
---|
| 69 | * Revision 1.7 2002/11/04 14:55:45 tng
|
---|
| 70 | * C++ Namespace Support.
|
---|
| 71 | *
|
---|
| 72 | * Revision 1.6 2002/07/11 18:29:09 knoaman
|
---|
| 73 | * Grammar caching/preparsing - initial implementation.
|
---|
| 74 | *
|
---|
| 75 | * Revision 1.5 2002/07/04 15:35:44 tng
|
---|
| 76 | * API Documentation typo fix.
|
---|
| 77 | *
|
---|
| 78 | * Revision 1.4 2002/06/27 18:46:53 tng
|
---|
| 79 | * API Documentation Update.
|
---|
| 80 | *
|
---|
| 81 | * Revision 1.3 2002/06/17 15:39:49 tng
|
---|
| 82 | * To be consistent, SAX2 is updated with:
|
---|
| 83 | * 1. the progressive parse methods should use the fReuseGrammar flag set from setFeature instead of using parameter
|
---|
| 84 | * 2. add feature "http://apache.org/xml/features/continue-after-fatal-error", and users should use setFeature instead of setExitOnFirstFatalError
|
---|
| 85 | * 3. add feature "http://apache.org/xml/features/validation-error-as-fatal", and users should use setFeature instead of setValidationConstraintFatal
|
---|
| 86 | *
|
---|
| 87 | * Revision 1.2 2002/05/30 16:22:53 tng
|
---|
| 88 | * Add feature to optionally ignore external DTD.
|
---|
| 89 | *
|
---|
| 90 | * Revision 1.1.1.1 2002/02/01 22:22:09 peiyongz
|
---|
| 91 | * sane_include
|
---|
| 92 | *
|
---|
| 93 | * Revision 1.18 2002/01/28 18:45:40 knoaman
|
---|
| 94 | * Update documentation for SAX2 feature 'namespace-prefixes'.
|
---|
| 95 | *
|
---|
| 96 | * Revision 1.17 2002/01/28 17:08:33 knoaman
|
---|
| 97 | * SAX2-ext's DeclHandler support.
|
---|
| 98 | *
|
---|
| 99 | * Revision 1.16 2002/01/18 16:31:26 tng
|
---|
| 100 | * Break program.xml which takes too long to load, into program-sax.xml, program-sax2.xml, program-dom.xml, program-idom.xml.
|
---|
| 101 | *
|
---|
| 102 | * Revision 1.15 2002/01/02 15:36:54 tng
|
---|
| 103 | * Some documentation update.
|
---|
| 104 | *
|
---|
| 105 | * Revision 1.14 2001/11/20 18:51:44 tng
|
---|
| 106 | * Schema: schemaLocation and noNamespaceSchemaLocation to be specified outside the instance document. New methods setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation are added (for SAX2, two new properties are added).
|
---|
| 107 | *
|
---|
| 108 | * Revision 1.13 2001/11/14 14:15:59 tng
|
---|
| 109 | * Update SAX2 feature documentation.
|
---|
| 110 | *
|
---|
| 111 | * Revision 1.12 2001/09/12 13:03:43 tng
|
---|
| 112 | * [Bug 3155] SAX2 does not offer progressive parse.
|
---|
| 113 | *
|
---|
| 114 | * Revision 1.11 2001/08/01 19:11:02 tng
|
---|
| 115 | * Add full schema constraint checking flag to the samples and the parser.
|
---|
| 116 | *
|
---|
| 117 | * Revision 1.10 2001/06/27 17:40:16 knoaman
|
---|
| 118 | * Fix for bug #2353.
|
---|
| 119 | *
|
---|
| 120 | * Revision 1.9 2001/06/19 16:44:31 tng
|
---|
| 121 | * Add installAdvDocHandler to SAX2XMLReader as the code is there already.
|
---|
| 122 | *
|
---|
| 123 | * Revision 1.8 2001/06/04 21:03:07 jberry
|
---|
| 124 | * Add pure virtual getErrorCount to SAX2XMLReader interface.
|
---|
| 125 | *
|
---|
| 126 | * Revision 1.7 2001/05/11 13:26:25 tng
|
---|
| 127 | * Copyright update.
|
---|
| 128 | *
|
---|
| 129 | * Revision 1.6 2001/02/15 15:56:31 tng
|
---|
| 130 | * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser.
|
---|
| 131 | * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader.
|
---|
| 132 | * New data field fSchemaValidation in XMLScanner as the flag.
|
---|
| 133 | *
|
---|
| 134 | * Revision 1.5 2001/01/12 21:22:00 tng
|
---|
| 135 | * Documentation Enhancement: Add list of SAX2 feature strings that are supported.
|
---|
| 136 | *
|
---|
| 137 | * Revision 1.4 2000/12/22 15:17:04 tng
|
---|
| 138 | * SAX2-ext's LexicalHandler support added by David Bertoni.
|
---|
| 139 | *
|
---|
| 140 | * Revision 1.3 2000/08/09 22:19:29 jpolast
|
---|
| 141 | * many conformance & stability changes:
|
---|
| 142 | * - ContentHandler::resetDocument() removed
|
---|
| 143 | * - attrs param of ContentHandler::startDocument() made const
|
---|
| 144 | * - SAXExceptions thrown now have msgs
|
---|
| 145 | * - removed duplicate function signatures that had 'const'
|
---|
| 146 | * [ eg: getContentHander() ]
|
---|
| 147 | * - changed getFeature and getProperty to apply to const objs
|
---|
| 148 | * - setProperty now takes a void* instead of const void*
|
---|
| 149 | * - SAX2XMLReaderImpl does not inherit from SAXParser anymore
|
---|
| 150 | * - Reuse Validator (http://apache.org/xml/features/reuse-validator) implemented
|
---|
| 151 | * - Features & Properties now read-only during parse
|
---|
| 152 | *
|
---|
| 153 | * Revision 1.2 2000/08/07 18:21:27 jpolast
|
---|
| 154 | * change SAX_EXPORT module to SAX2_EXPORT
|
---|
| 155 | *
|
---|
| 156 | * Revision 1.1 2000/08/02 18:02:35 jpolast
|
---|
| 157 | * initial checkin of sax2 implementation
|
---|
| 158 | * submitted by Simon Fell (simon@fell.com)
|
---|
| 159 | * and Joe Polastre (jpolast@apache.org)
|
---|
| 160 | *
|
---|
| 161 | *
|
---|
| 162 | */
|
---|
| 163 |
|
---|
| 164 | #ifndef SAX2XMLReader_HPP
|
---|
| 165 | #define SAX2XMLReader_HPP
|
---|
| 166 |
|
---|
| 167 | #include <xercesc/util/XercesDefs.hpp>
|
---|
| 168 | #include <xercesc/util/XMLUniDefs.hpp>
|
---|
| 169 | #include <xercesc/framework/XMLValidator.hpp>
|
---|
| 170 | #include <xercesc/framework/XMLPScanToken.hpp>
|
---|
| 171 |
|
---|
| 172 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 173 |
|
---|
| 174 | class ContentHandler ;
|
---|
| 175 | class DTDHandler;
|
---|
| 176 | class EntityResolver;
|
---|
| 177 | class ErrorHandler;
|
---|
| 178 | class InputSource;
|
---|
| 179 | class LexicalHandler;
|
---|
| 180 | class DeclHandler;
|
---|
| 181 | class XMLDocumentHandler;
|
---|
| 182 | class Grammar;
|
---|
| 183 |
|
---|
| 184 | class SAX2_EXPORT SAX2XMLReader
|
---|
| 185 | {
|
---|
| 186 | public:
|
---|
| 187 | // -----------------------------------------------------------------------
|
---|
| 188 | // Class types
|
---|
| 189 | // -----------------------------------------------------------------------
|
---|
| 190 | /** @name Public constants */
|
---|
| 191 | //@{
|
---|
| 192 |
|
---|
| 193 | /** ValScheme enum used in setValidationScheme
|
---|
| 194 | * Val_Never: Do not report validation errors.
|
---|
| 195 | * Val_Always: The parser will always report validation errors.
|
---|
| 196 | * Val_Auto: The parser will report validation errors only if a grammar is specified.
|
---|
| 197 | *
|
---|
| 198 | * @see #setValidationScheme
|
---|
| 199 | */
|
---|
| 200 | enum ValSchemes
|
---|
| 201 | {
|
---|
| 202 | Val_Never
|
---|
| 203 | , Val_Always
|
---|
| 204 | , Val_Auto
|
---|
| 205 | };
|
---|
| 206 | //@}
|
---|
| 207 |
|
---|
| 208 |
|
---|
| 209 | // -----------------------------------------------------------------------
|
---|
| 210 | // Constructors and Destructor
|
---|
| 211 | // -----------------------------------------------------------------------
|
---|
| 212 | /** @name Constructors and Destructor */
|
---|
| 213 | //@{
|
---|
| 214 | /** The default constructor */
|
---|
| 215 | SAX2XMLReader()
|
---|
| 216 | {
|
---|
| 217 | }
|
---|
| 218 | /** The destructor */
|
---|
| 219 | virtual ~SAX2XMLReader()
|
---|
| 220 | {
|
---|
| 221 | }
|
---|
| 222 | //@}
|
---|
| 223 |
|
---|
| 224 | //-----------------------------------------------------------------------
|
---|
| 225 | // The XMLReader interface
|
---|
| 226 | //-----------------------------------------------------------------------
|
---|
| 227 | /** @name Implementation of SAX 2.0 XMLReader interface's. */
|
---|
| 228 | //@{
|
---|
| 229 |
|
---|
| 230 | /**
|
---|
| 231 | * This method returns the installed content handler.
|
---|
| 232 | *
|
---|
| 233 | * @return A pointer to the installed content handler object.
|
---|
| 234 | */
|
---|
| 235 | virtual ContentHandler* getContentHandler() const = 0 ;
|
---|
| 236 |
|
---|
| 237 | /**
|
---|
| 238 | * This method returns the installed DTD handler.
|
---|
| 239 | *
|
---|
| 240 | * @return A pointer to the installed DTD handler object.
|
---|
| 241 | */
|
---|
| 242 | virtual DTDHandler* getDTDHandler() const = 0;
|
---|
| 243 |
|
---|
| 244 | /**
|
---|
| 245 | * This method returns the installed entity resolver.
|
---|
| 246 | *
|
---|
| 247 | * @return A pointer to the installed entity resolver object.
|
---|
| 248 | */
|
---|
| 249 | virtual EntityResolver* getEntityResolver() const = 0 ;
|
---|
| 250 |
|
---|
| 251 | /**
|
---|
| 252 | * This method returns the installed error handler.
|
---|
| 253 | *
|
---|
| 254 | * @return A pointer to the installed error handler object.
|
---|
| 255 | */
|
---|
| 256 | virtual ErrorHandler* getErrorHandler() const = 0 ;
|
---|
| 257 |
|
---|
| 258 | /**
|
---|
| 259 | * Query the current state of any feature in a SAX2 XMLReader.
|
---|
| 260 | *
|
---|
| 261 | * @param name The unique identifier (URI) of the feature being set.
|
---|
| 262 | * @return The current state of the feature.
|
---|
| 263 | * @exception SAXNotRecognizedException If the requested feature is not known.
|
---|
| 264 | */
|
---|
| 265 | virtual bool getFeature(const XMLCh* const name) const = 0;
|
---|
| 266 |
|
---|
| 267 | /**
|
---|
| 268 | * Query the current value of a property in a SAX2 XMLReader.
|
---|
| 269 | *
|
---|
| 270 | * The parser owns the returned pointer. The memory allocated for
|
---|
| 271 | * the returned pointer will be destroyed when the parser is deleted.
|
---|
| 272 | *
|
---|
| 273 | * To ensure assessiblity of the returned information after the parser
|
---|
| 274 | * is deleted, callers need to copy and store the returned information
|
---|
| 275 | * somewhere else; otherwise you may get unexpected result. Since the returned
|
---|
| 276 | * pointer is a generic void pointer, see
|
---|
| 277 | * http://xml.apache.org/xerces-c/program-sax2.html#SAX2Properties to learn
|
---|
| 278 | * exactly what type of property value each property returns for replication.
|
---|
| 279 | *
|
---|
| 280 | * @param name The unique identifier (URI) of the property being set.
|
---|
| 281 | * @return The current value of the property. The pointer spans the same
|
---|
| 282 | * life-time as the parser. A null pointer is returned if nothing
|
---|
| 283 | * was specified externally.
|
---|
| 284 | * @exception SAXNotRecognizedException If the requested property is not known.
|
---|
| 285 | */
|
---|
| 286 | virtual void* getProperty(const XMLCh* const name) const = 0 ;
|
---|
| 287 |
|
---|
| 288 | /**
|
---|
| 289 | * Allow an application to register a document event handler.
|
---|
| 290 | *
|
---|
| 291 | * If the application does not register a document handler, all
|
---|
| 292 | * document events reported by the SAX parser will be silently
|
---|
| 293 | * ignored (this is the default behaviour implemented by
|
---|
| 294 | * HandlerBase).
|
---|
| 295 | *
|
---|
| 296 | * Applications may register a new or different handler in the
|
---|
| 297 | * middle of a parse, and the SAX parser must begin using the new
|
---|
| 298 | * handler immediately.
|
---|
| 299 | *
|
---|
| 300 | * @param handler The document handler.
|
---|
| 301 | * @see DocumentHandler#DocumentHandler
|
---|
| 302 | * @see HandlerBase#HandlerBase
|
---|
| 303 | */
|
---|
| 304 | virtual void setContentHandler(ContentHandler* const handler) = 0;
|
---|
| 305 |
|
---|
| 306 | /**
|
---|
| 307 | * Allow an application to register a DTD event handler.
|
---|
| 308 | *
|
---|
| 309 | * If the application does not register a DTD handler, all DTD
|
---|
| 310 | * events reported by the SAX parser will be silently ignored (this
|
---|
| 311 | * is the default behaviour implemented by HandlerBase).
|
---|
| 312 | *
|
---|
| 313 | * Applications may register a new or different handler in the middle
|
---|
| 314 | * of a parse, and the SAX parser must begin using the new handler
|
---|
| 315 | * immediately.
|
---|
| 316 | *
|
---|
| 317 | * @param handler The DTD handler.
|
---|
| 318 | * @see DTDHandler#DTDHandler
|
---|
| 319 | * @see HandlerBase#HandlerBase
|
---|
| 320 | */
|
---|
| 321 | virtual void setDTDHandler(DTDHandler* const handler) = 0;
|
---|
| 322 |
|
---|
| 323 | /**
|
---|
| 324 | * Allow an application to register a custom entity resolver.
|
---|
| 325 | *
|
---|
| 326 | * If the application does not register an entity resolver, the
|
---|
| 327 | * SAX parser will resolve system identifiers and open connections
|
---|
| 328 | * to entities itself (this is the default behaviour implemented in
|
---|
| 329 | * DefaultHandler).
|
---|
| 330 | *
|
---|
| 331 | * Applications may register a new or different entity resolver
|
---|
| 332 | * in the middle of a parse, and the SAX parser must begin using
|
---|
| 333 | * the new resolver immediately.
|
---|
| 334 | *
|
---|
| 335 | * @param resolver The object for resolving entities.
|
---|
| 336 | * @see EntityResolver#EntityResolver
|
---|
| 337 | * @see DefaultHandler#DefaultHandler
|
---|
| 338 | */
|
---|
| 339 | virtual void setEntityResolver(EntityResolver* const resolver) = 0;
|
---|
| 340 |
|
---|
| 341 | /**
|
---|
| 342 | * Allow an application to register an error event handler.
|
---|
| 343 | *
|
---|
| 344 | * If the application does not register an error event handler,
|
---|
| 345 | * all error events reported by the SAX parser will be silently
|
---|
| 346 | * ignored, except for fatalError, which will throw a SAXException
|
---|
| 347 | * (this is the default behaviour implemented by HandlerBase).
|
---|
| 348 | *
|
---|
| 349 | * Applications may register a new or different handler in the
|
---|
| 350 | * middle of a parse, and the SAX parser must begin using the new
|
---|
| 351 | * handler immediately.
|
---|
| 352 | *
|
---|
| 353 | * @param handler The error handler.
|
---|
| 354 | * @see ErrorHandler#ErrorHandler
|
---|
| 355 | * @see SAXException#SAXException
|
---|
| 356 | * @see HandlerBase#HandlerBase
|
---|
| 357 | */
|
---|
| 358 | virtual void setErrorHandler(ErrorHandler* const handler) = 0;
|
---|
| 359 |
|
---|
| 360 | /**
|
---|
| 361 | * Set the state of any feature in a SAX2 XMLReader.
|
---|
| 362 | * Supported features in SAX2 for xerces-c are:
|
---|
| 363 | * <br>(See http://xml.apache.org/xerces-c/program-sax2.html#SAX2Features for detail description).
|
---|
| 364 | *
|
---|
| 365 | * <br>http://xml.org/sax/features/validation (default: true)
|
---|
| 366 | * <br>http://xml.org/sax/features/namespaces (default: true)
|
---|
| 367 | * <br>http://xml.org/sax/features/namespace-prefixes (default: false)
|
---|
| 368 | * <br>http://apache.org/xml/features/validation/dynamic (default: false)
|
---|
| 369 | * <br>http://apache.org/xml/features/validation/reuse-grammar (default: false)
|
---|
| 370 | * <br>http://apache.org/xml/features/validation/schema (default: true)
|
---|
| 371 | * <br>http://apache.org/xml/features/validation/schema-full-checking (default: false)
|
---|
| 372 | * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)
|
---|
| 373 | * <br>http://apache.org/xml/features/continue-after-fatal-error (default: false)
|
---|
| 374 | * <br>http://apache.org/xml/features/validation-error-as-fatal (default: false)
|
---|
| 375 | * <br>http://apache.org/xml/features/validation/reuse-validator (Deprecated) (default: false)
|
---|
| 376 | *
|
---|
| 377 | * @param name The unique identifier (URI) of the feature.
|
---|
| 378 | * @param value The requested state of the feature (true or false).
|
---|
| 379 | * @exception SAXNotRecognizedException If the requested feature is not known.
|
---|
| 380 | * @exception SAXNotSupportedException Feature modification is not supported during parse
|
---|
| 381 | *
|
---|
| 382 | */
|
---|
| 383 | virtual void setFeature(const XMLCh* const name, const bool value) = 0;
|
---|
| 384 |
|
---|
| 385 | /**
|
---|
| 386 | * Set the value of any property in a SAX2 XMLReader.
|
---|
| 387 | * Supported properties in SAX2 for xerces-c are:
|
---|
| 388 | * <br>(See http://xml.apache.org/xerces-c/program-sax2.html#SAX2Properties for detail description).
|
---|
| 389 | *
|
---|
| 390 | * <br>http://apache.org/xml/properties/schema/external-schemaLocation
|
---|
| 391 | * <br>http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation.
|
---|
| 392 | *
|
---|
| 393 | * It takes a void pointer as the property value. Application is required to initialize this void
|
---|
| 394 | * pointer to a correct type. See http://xml.apache.org/xerces-c/program-sax2.html#SAX2Properties
|
---|
| 395 | * to learn exactly what type of property value each property expects for processing.
|
---|
| 396 | * Passing a void pointer that was initialized with a wrong type will lead to unexpected result.
|
---|
| 397 | * If the same property is set more than once, the last one takes effect.
|
---|
| 398 | *
|
---|
| 399 | * @param name The unique identifier (URI) of the property being set.
|
---|
| 400 | * @param value The requested value for the property. See
|
---|
| 401 | * http://xml.apache.org/xerces-c/program-sax2.html#SAX2Properties to learn
|
---|
| 402 | * exactly what type of property value each property expects for processing.
|
---|
| 403 | * Passing a void pointer that was initialized with a wrong type will lead
|
---|
| 404 | * to unexpected result.
|
---|
| 405 | * @exception SAXNotRecognizedException If the requested property is not known.
|
---|
| 406 | * @exception SAXNotSupportedException Property modification is not supported during parse
|
---|
| 407 | */
|
---|
| 408 | virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
|
---|
| 409 |
|
---|
| 410 | /**
|
---|
| 411 | * Parse an XML document.
|
---|
| 412 | *
|
---|
| 413 | * The application can use this method to instruct the SAX parser
|
---|
| 414 | * to begin parsing an XML document from any valid input
|
---|
| 415 | * source (a character stream, a byte stream, or a URI).
|
---|
| 416 | *
|
---|
| 417 | * Applications may not invoke this method while a parse is in
|
---|
| 418 | * progress (they should create a new Parser instead for each
|
---|
| 419 | * additional XML document). Once a parse is complete, an
|
---|
| 420 | * application may reuse the same Parser object, possibly with a
|
---|
| 421 | * different input source.
|
---|
| 422 | *
|
---|
| 423 | * @param source The input source for the top-level of the
|
---|
| 424 | * XML document.
|
---|
| 425 | * @exception SAXException Any SAX exception, possibly
|
---|
| 426 | * wrapping another exception.
|
---|
| 427 | * @exception XMLException An exception from the parser or client
|
---|
| 428 | * handler code.
|
---|
| 429 | * @see InputSource#InputSource
|
---|
| 430 | * @see #setEntityResolver
|
---|
| 431 | * @see #setDTDHandler
|
---|
| 432 | * @see #setDocumentHandler
|
---|
| 433 | * @see #setErrorHandler
|
---|
| 434 | */
|
---|
| 435 | virtual void parse
|
---|
| 436 | (
|
---|
| 437 | const InputSource& source
|
---|
| 438 | ) = 0;
|
---|
| 439 |
|
---|
| 440 | /**
|
---|
| 441 | * Parse an XML document from a system identifier (URI).
|
---|
| 442 | *
|
---|
| 443 | * This method is a shortcut for the common case of reading a
|
---|
| 444 | * document from a system identifier. It is the exact equivalent
|
---|
| 445 | * of the following:
|
---|
| 446 | *
|
---|
| 447 | * parse(new URLInputSource(systemId));
|
---|
| 448 | *
|
---|
| 449 | * If the system identifier is a URL, it must be fully resolved
|
---|
| 450 | * by the application before it is passed to the parser.
|
---|
| 451 | *
|
---|
| 452 | * @param systemId The system identifier (URI).
|
---|
| 453 | * @exception SAXException Any SAX exception, possibly
|
---|
| 454 | * wrapping another exception.
|
---|
| 455 | * @exception XMLException An exception from the parser or client
|
---|
| 456 | * handler code.
|
---|
| 457 | * @see #parse(InputSource)
|
---|
| 458 | */
|
---|
| 459 | virtual void parse
|
---|
| 460 | (
|
---|
| 461 | const XMLCh* const systemId
|
---|
| 462 | ) = 0;
|
---|
| 463 |
|
---|
| 464 | /**
|
---|
| 465 | * Parse an XML document from a system identifier (URI).
|
---|
| 466 | *
|
---|
| 467 | * This method is a shortcut for the common case of reading a
|
---|
| 468 | * document from a system identifier. It is the exact equivalent
|
---|
| 469 | * of the following:
|
---|
| 470 | *
|
---|
| 471 | * parse(new URLInputSource(systemId));
|
---|
| 472 | *
|
---|
| 473 | * If the system identifier is a URL, it must be fully resolved
|
---|
| 474 | * by the application before it is passed to the parser.
|
---|
| 475 | *
|
---|
| 476 | * @param systemId The system identifier (URI).
|
---|
| 477 | * @exception SAXException Any SAX exception, possibly
|
---|
| 478 | * wrapping another exception.
|
---|
| 479 | * @exception XMLException An exception from the parser or client
|
---|
| 480 | * handler code.
|
---|
| 481 | * @see #parse(InputSource)
|
---|
| 482 | */
|
---|
| 483 | virtual void parse
|
---|
| 484 | (
|
---|
| 485 | const char* const systemId
|
---|
| 486 | ) = 0;
|
---|
| 487 |
|
---|
| 488 | //@}
|
---|
| 489 |
|
---|
| 490 | // -----------------------------------------------------------------------
|
---|
| 491 | // SAX 2.0-ext
|
---|
| 492 | // -----------------------------------------------------------------------
|
---|
| 493 | /** @name SAX 2.0-ext */
|
---|
| 494 | //@{
|
---|
| 495 | /**
|
---|
| 496 | * This method returns the installed declaration handler.
|
---|
| 497 | *
|
---|
| 498 | * @return A pointer to the installed declaration handler object.
|
---|
| 499 | */
|
---|
| 500 | virtual DeclHandler* getDeclarationHandler() const = 0 ;
|
---|
| 501 |
|
---|
| 502 | /**
|
---|
| 503 | * This method returns the installed lexical handler.
|
---|
| 504 | *
|
---|
| 505 | * @return A pointer to the installed lexical handler object.
|
---|
| 506 | */
|
---|
| 507 | virtual LexicalHandler* getLexicalHandler() const = 0 ;
|
---|
| 508 |
|
---|
| 509 | /**
|
---|
| 510 | * Allow an application to register a declaration event handler.
|
---|
| 511 | *
|
---|
| 512 | * If the application does not register a declaration handler,
|
---|
| 513 | * all events reported by the SAX parser will be silently
|
---|
| 514 | * ignored. (this is the default behaviour implemented by DefaultHandler).
|
---|
| 515 | *
|
---|
| 516 | * Applications may register a new or different handler in the
|
---|
| 517 | * middle of a parse, and the SAX parser must begin using the new
|
---|
| 518 | * handler immediately.
|
---|
| 519 | *
|
---|
| 520 | * @param handler The DTD declaration handler.
|
---|
| 521 | * @see DeclHandler#DeclHandler
|
---|
| 522 | * @see SAXException#SAXException
|
---|
| 523 | * @see DefaultHandler#DefaultHandler
|
---|
| 524 | */
|
---|
| 525 | virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
|
---|
| 526 |
|
---|
| 527 | /**
|
---|
| 528 | * Allow an application to register a lexical event handler.
|
---|
| 529 | *
|
---|
| 530 | * If the application does not register a lexical handler,
|
---|
| 531 | * all events reported by the SAX parser will be silently
|
---|
| 532 | * ignored. (this is the default behaviour implemented by HandlerBase).
|
---|
| 533 | *
|
---|
| 534 | * Applications may register a new or different handler in the
|
---|
| 535 | * middle of a parse, and the SAX parser must begin using the new
|
---|
| 536 | * handler immediately.
|
---|
| 537 | *
|
---|
| 538 | * @param handler The error handler.
|
---|
| 539 | * @see LexicalHandler#LexicalHandler
|
---|
| 540 | * @see SAXException#SAXException
|
---|
| 541 | * @see HandlerBase#HandlerBase
|
---|
| 542 | */
|
---|
| 543 | virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
|
---|
| 544 |
|
---|
| 545 | //@}
|
---|
| 546 |
|
---|
| 547 | // -----------------------------------------------------------------------
|
---|
| 548 | // Getter Methods
|
---|
| 549 | // -----------------------------------------------------------------------
|
---|
| 550 | /** @name Getter Methods (Xerces-C specific) */
|
---|
| 551 | //@{
|
---|
| 552 | /**
|
---|
| 553 | * This method is used to get the current validator.
|
---|
| 554 | *
|
---|
| 555 | * <b>SAX2XMLReader assumes responsibility for the validator. It will be
|
---|
| 556 | * deleted when the XMLReader is destroyed.</b>
|
---|
| 557 | *
|
---|
| 558 | * @return A pointer to the validator. An application should not deleted
|
---|
| 559 | * the object returned.
|
---|
| 560 | *
|
---|
| 561 | */
|
---|
| 562 | virtual XMLValidator* getValidator() const = 0;
|
---|
| 563 |
|
---|
| 564 | /** Get error count from the last parse operation.
|
---|
| 565 | *
|
---|
| 566 | * This method returns the error count from the last parse
|
---|
| 567 | * operation. Note that this count is actually stored in the
|
---|
| 568 | * scanner, so this method simply returns what the
|
---|
| 569 | * scanner reports.
|
---|
| 570 | *
|
---|
| 571 | * @return number of errors encountered during the latest
|
---|
| 572 | * parse operation.
|
---|
| 573 | */
|
---|
| 574 | virtual int getErrorCount() const = 0 ;
|
---|
| 575 |
|
---|
| 576 | /**
|
---|
| 577 | * This method returns the state of the parser's
|
---|
| 578 | * exit-on-First-Fatal-Error flag.
|
---|
| 579 | *
|
---|
| 580 | * <p>Or you can query the feature "http://apache.org/xml/features/continue-after-fatal-error"
|
---|
| 581 | * which indicates the opposite state.</p>
|
---|
| 582 | *
|
---|
| 583 | * @return true, if the parser is currently configured to
|
---|
| 584 | * exit on the first fatal error, false otherwise.
|
---|
| 585 | *
|
---|
| 586 | * @see #setExitOnFirstFatalError
|
---|
| 587 | * @see #getFeature
|
---|
| 588 | */
|
---|
| 589 | virtual bool getExitOnFirstFatalError() const = 0;
|
---|
| 590 |
|
---|
| 591 | /**
|
---|
| 592 | * This method returns the state of the parser's
|
---|
| 593 | * validation-constraint-fatal flag.
|
---|
| 594 | *
|
---|
| 595 | * <p>Or you can query the feature "http://apache.org/xml/features/validation-error-as-fatal"
|
---|
| 596 | * which means the same thing.
|
---|
| 597 | *
|
---|
| 598 | * @return true, if the parser is currently configured to
|
---|
| 599 | * set validation constraint errors as fatal, false
|
---|
| 600 | * otherwise.
|
---|
| 601 | *
|
---|
| 602 | * @see #setValidationContraintFatal
|
---|
| 603 | * @see #getFeature
|
---|
| 604 | */
|
---|
| 605 | virtual bool getValidationConstraintFatal() const = 0;
|
---|
| 606 |
|
---|
| 607 | /**
|
---|
| 608 | * Retrieve the grammar that is associated with the specified namespace key
|
---|
| 609 | *
|
---|
| 610 | * @param nameSpaceKey Namespace key
|
---|
| 611 | * @return Grammar associated with the Namespace key.
|
---|
| 612 | */
|
---|
| 613 | virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0;
|
---|
| 614 |
|
---|
| 615 | /**
|
---|
| 616 | * Retrieve the grammar where the root element is declared.
|
---|
| 617 | *
|
---|
| 618 | * @return Grammar where root element declared
|
---|
| 619 | */
|
---|
| 620 | virtual Grammar* getRootGrammar() = 0;
|
---|
| 621 |
|
---|
| 622 | /**
|
---|
| 623 | * Returns the string corresponding to a URI id from the URI string pool.
|
---|
| 624 | *
|
---|
| 625 | * @param uriId id of the string in the URI string pool.
|
---|
| 626 | * @return URI string corresponding to the URI id.
|
---|
| 627 | */
|
---|
| 628 | virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
|
---|
| 629 |
|
---|
| 630 | /**
|
---|
| 631 | * Returns the current src offset within the input source.
|
---|
| 632 | *
|
---|
| 633 | * @return offset within the input source
|
---|
| 634 | */
|
---|
| 635 | virtual unsigned int getSrcOffset() const = 0;
|
---|
| 636 |
|
---|
| 637 | //@}
|
---|
| 638 |
|
---|
| 639 | // -----------------------------------------------------------------------
|
---|
| 640 | // Setter Methods
|
---|
| 641 | // -----------------------------------------------------------------------
|
---|
| 642 | /** @name Setter Methods (Xerces-C specific) */
|
---|
| 643 | //@{
|
---|
| 644 | /**
|
---|
| 645 | * This method is used to set a validator.
|
---|
| 646 | *
|
---|
| 647 | * <b>SAX2XMLReader assumes responsibility for the validator. It will be
|
---|
| 648 | * deleted when the XMLReader is destroyed.</b>
|
---|
| 649 | *
|
---|
| 650 | * @param valueToAdopt A pointer to the validator that the reader should use.
|
---|
| 651 | *
|
---|
| 652 | */
|
---|
| 653 | virtual void setValidator(XMLValidator* valueToAdopt) = 0;
|
---|
| 654 |
|
---|
| 655 | /**
|
---|
| 656 | * This method allows users to set the parser's behaviour when it
|
---|
| 657 | * encounters the first fatal error. If set to true, the parser
|
---|
| 658 | * will exit at the first fatal error. If false, then it will
|
---|
| 659 | * report the error and continue processing.
|
---|
| 660 | *
|
---|
| 661 | * <p>The default value is 'true' and the parser exits on the
|
---|
| 662 | * first fatal error.</p>
|
---|
| 663 | *
|
---|
| 664 | * <p>Or you can set the feature "http://apache.org/xml/features/continue-after-fatal-error"
|
---|
| 665 | * which has the opposite behaviour.</p>
|
---|
| 666 | *
|
---|
| 667 | * <p>If both the feature above and this function are used, the latter takes effect.</p>
|
---|
| 668 | *
|
---|
| 669 | * @param newState The value specifying whether the parser should
|
---|
| 670 | * continue or exit when it encounters the first
|
---|
| 671 | * fatal error.
|
---|
| 672 | *
|
---|
| 673 | * @see #getExitOnFirstFatalError
|
---|
| 674 | * @see #setFeature
|
---|
| 675 | */
|
---|
| 676 | virtual void setExitOnFirstFatalError(const bool newState) = 0;
|
---|
| 677 |
|
---|
| 678 | /**
|
---|
| 679 | * This method allows users to set the parser's behaviour when it
|
---|
| 680 | * encounters a validtion constraint error. If set to true, and the
|
---|
| 681 | * the parser will treat validation error as fatal and will exit depends on the
|
---|
| 682 | * state of "getExitOnFirstFatalError". If false, then it will
|
---|
| 683 | * report the error and continue processing.
|
---|
| 684 | *
|
---|
| 685 | * Note: setting this true does not mean the validation error will be printed with
|
---|
| 686 | * the word "Fatal Error". It is still printed as "Error", but the parser
|
---|
| 687 | * will exit if "setExitOnFirstFatalError" is set to true.
|
---|
| 688 | *
|
---|
| 689 | * <p>The default value is 'false'.</p>
|
---|
| 690 | *
|
---|
| 691 | * <p>Or you can set the feature "http://apache.org/xml/features/validation-error-as-fatal"
|
---|
| 692 | * which means the same thing.</p>
|
---|
| 693 | *
|
---|
| 694 | * <p>If both the feature above and this function are used, the latter takes effect.</p>
|
---|
| 695 | *
|
---|
| 696 | * @param newState If true, the parser will exit if "setExitOnFirstFatalError"
|
---|
| 697 | * is set to true.
|
---|
| 698 | *
|
---|
| 699 | * @see #getValidationConstraintFatal
|
---|
| 700 | * @see #setExitOnFirstFatalError
|
---|
| 701 | * @see #setFeature
|
---|
| 702 | */
|
---|
| 703 | virtual void setValidationConstraintFatal(const bool newState) = 0;
|
---|
| 704 | //@}
|
---|
| 705 |
|
---|
| 706 |
|
---|
| 707 | // -----------------------------------------------------------------------
|
---|
| 708 | // Progressive scan methods
|
---|
| 709 | // -----------------------------------------------------------------------
|
---|
| 710 |
|
---|
| 711 | /** @name Progressive scan methods */
|
---|
| 712 | //@{
|
---|
| 713 |
|
---|
| 714 | /** Begin a progressive parse operation
|
---|
| 715 | *
|
---|
| 716 | * This method is used to start a progressive parse on a XML file.
|
---|
| 717 | * To continue parsing, subsequent calls must be to the parseNext
|
---|
| 718 | * method.
|
---|
| 719 | *
|
---|
| 720 | * It scans through the prolog and returns a token to be used on
|
---|
| 721 | * subsequent scanNext() calls. If the return value is true, then the
|
---|
| 722 | * token is legal and ready for further use. If it returns false, then
|
---|
| 723 | * the scan of the prolog failed and the token is not going to work on
|
---|
| 724 | * subsequent scanNext() calls.
|
---|
| 725 | *
|
---|
| 726 | * @param systemId A pointer to a Unicode string represting the path
|
---|
| 727 | * to the XML file to be parsed.
|
---|
| 728 | * @param toFill A token maintaing state information to maintain
|
---|
| 729 | * internal consistency between invocation of 'parseNext'
|
---|
| 730 | * calls.
|
---|
| 731 | *
|
---|
| 732 | * @return 'true', if successful in parsing the prolog. It indicates the
|
---|
| 733 | * user can go ahead with parsing the rest of the file. It
|
---|
| 734 | * returns 'false' to indicate that the parser could parse the
|
---|
| 735 | * prolog (which means the token will not be valid.)
|
---|
| 736 | *
|
---|
| 737 | * @see #parseNext
|
---|
| 738 | * @see #parseFirst(char*,...)
|
---|
| 739 | * @see #parseFirst(InputSource&,...)
|
---|
| 740 | */
|
---|
| 741 | virtual bool parseFirst
|
---|
| 742 | (
|
---|
| 743 | const XMLCh* const systemId
|
---|
| 744 | , XMLPScanToken& toFill
|
---|
| 745 | ) = 0;
|
---|
| 746 |
|
---|
| 747 | /** Begin a progressive parse operation
|
---|
| 748 | *
|
---|
| 749 | * This method is used to start a progressive parse on a XML file.
|
---|
| 750 | * To continue parsing, subsequent calls must be to the parseNext
|
---|
| 751 | * method.
|
---|
| 752 | *
|
---|
| 753 | * It scans through the prolog and returns a token to be used on
|
---|
| 754 | * subsequent scanNext() calls. If the return value is true, then the
|
---|
| 755 | * token is legal and ready for further use. If it returns false, then
|
---|
| 756 | * the scan of the prolog failed and the token is not going to work on
|
---|
| 757 | * subsequent scanNext() calls.
|
---|
| 758 | *
|
---|
| 759 | * @param systemId A pointer to a regular native string represting
|
---|
| 760 | * the path to the XML file to be parsed.
|
---|
| 761 | * @param toFill A token maintaing state information to maintain
|
---|
| 762 | * internal consIstency between invocation of 'parseNext'
|
---|
| 763 | * calls.
|
---|
| 764 | *
|
---|
| 765 | * @return 'true', if successful in parsing the prolog. It indicates the
|
---|
| 766 | * user can go ahead with parsing the rest of the file. It
|
---|
| 767 | * returns 'false' to indicate that the parser could not parse
|
---|
| 768 | * the prolog.
|
---|
| 769 | *
|
---|
| 770 | * @see #parseNext
|
---|
| 771 | * @see #parseFirst(XMLCh*,...)
|
---|
| 772 | * @see #parseFirst(InputSource&,...)
|
---|
| 773 | */
|
---|
| 774 | virtual bool parseFirst
|
---|
| 775 | (
|
---|
| 776 | const char* const systemId
|
---|
| 777 | , XMLPScanToken& toFill
|
---|
| 778 | ) = 0;
|
---|
| 779 |
|
---|
| 780 | /** Begin a progressive parse operation
|
---|
| 781 | *
|
---|
| 782 | * This method is used to start a progressive parse on a XML file.
|
---|
| 783 | * To continue parsing, subsequent calls must be to the parseNext
|
---|
| 784 | * method.
|
---|
| 785 | *
|
---|
| 786 | * It scans through the prolog and returns a token to be used on
|
---|
| 787 | * subsequent scanNext() calls. If the return value is true, then the
|
---|
| 788 | * token is legal and ready for further use. If it returns false, then
|
---|
| 789 | * the scan of the prolog failed and the token is not going to work on
|
---|
| 790 | * subsequent scanNext() calls.
|
---|
| 791 | *
|
---|
| 792 | * @param source A const reference to the InputSource object which
|
---|
| 793 | * points to the XML file to be parsed.
|
---|
| 794 | * @param toFill A token maintaing state information to maintain
|
---|
| 795 | * internal consistency between invocation of 'parseNext'
|
---|
| 796 | * calls.
|
---|
| 797 | *
|
---|
| 798 | * @return 'true', if successful in parsing the prolog. It indicates the
|
---|
| 799 | * user can go ahead with parsing the rest of the file. It
|
---|
| 800 | * returns 'false' to indicate that the parser could not parse
|
---|
| 801 | * the prolog.
|
---|
| 802 | *
|
---|
| 803 | * @see #parseNext
|
---|
| 804 | * @see #parseFirst(XMLCh*,...)
|
---|
| 805 | * @see #parseFirst(char*,...)
|
---|
| 806 | */
|
---|
| 807 | virtual bool parseFirst
|
---|
| 808 | (
|
---|
| 809 | const InputSource& source
|
---|
| 810 | , XMLPScanToken& toFill
|
---|
| 811 | ) = 0;
|
---|
| 812 |
|
---|
| 813 | /** Continue a progressive parse operation
|
---|
| 814 | *
|
---|
| 815 | * This method is used to continue with progressive parsing of
|
---|
| 816 | * XML files started by a call to 'parseFirst' method.
|
---|
| 817 | *
|
---|
| 818 | * It parses the XML file and stops as soon as it comes across
|
---|
| 819 | * a XML token (as defined in the XML specification). Relevant
|
---|
| 820 | * callback handlers are invoked as required by the SAX
|
---|
| 821 | * specification.
|
---|
| 822 | *
|
---|
| 823 | * @param token A token maintaing state information to maintain
|
---|
| 824 | * internal consistency between invocation of 'parseNext'
|
---|
| 825 | * calls.
|
---|
| 826 | *
|
---|
| 827 | * @return 'true', if successful in parsing the next XML token.
|
---|
| 828 | * It indicates the user can go ahead with parsing the rest
|
---|
| 829 | * of the file. It returns 'false' to indicate that the parser
|
---|
| 830 | * could not find next token as per the XML specification
|
---|
| 831 | * production rule.
|
---|
| 832 | *
|
---|
| 833 | * @see #parseFirst(XMLCh*,...)
|
---|
| 834 | * @see #parseFirst(char*,...)
|
---|
| 835 | * @see #parseFirst(InputSource&,...)
|
---|
| 836 | */
|
---|
| 837 | virtual bool parseNext(XMLPScanToken& token) = 0;
|
---|
| 838 |
|
---|
| 839 | /** Reset the parser after a progressive parse
|
---|
| 840 | *
|
---|
| 841 | * If a progressive parse loop exits before the end of the document
|
---|
| 842 | * is reached, the parser has no way of knowing this. So it will leave
|
---|
| 843 | * open any files or sockets or memory buffers that were in use at
|
---|
| 844 | * the time that the parse loop exited.
|
---|
| 845 | *
|
---|
| 846 | * The next parse operation will cause these open files and such to
|
---|
| 847 | * be closed, but the next parse operation might occur at some unknown
|
---|
| 848 | * future point. To avoid this problem, you should reset the parser if
|
---|
| 849 | * you exit the loop early.
|
---|
| 850 | *
|
---|
| 851 | * If you exited because of an error, then this cleanup will be done
|
---|
| 852 | * for you. Its only when you exit the file prematurely of your own
|
---|
| 853 | * accord, because you've found what you wanted in the file most
|
---|
| 854 | * likely.
|
---|
| 855 | *
|
---|
| 856 | * @param token A token maintaing state information to maintain
|
---|
| 857 | * internal consistency between invocation of 'parseNext'
|
---|
| 858 | * calls.
|
---|
| 859 | */
|
---|
| 860 | virtual void parseReset(XMLPScanToken& token) = 0;
|
---|
| 861 |
|
---|
| 862 | //@}
|
---|
| 863 |
|
---|
| 864 | // -----------------------------------------------------------------------
|
---|
| 865 | // Grammar preparsing interface
|
---|
| 866 | // -----------------------------------------------------------------------
|
---|
| 867 |
|
---|
| 868 | /** @name Grammar preparsing interface's. */
|
---|
| 869 | //@{
|
---|
| 870 | /**
|
---|
| 871 | * Preparse schema grammar (XML Schema, DTD, etc.) via an input source
|
---|
| 872 | * object.
|
---|
| 873 | *
|
---|
| 874 | * This method invokes the preparsing process on a schema grammar XML
|
---|
| 875 | * file specified by the SAX InputSource parameter. If the 'toCache' flag
|
---|
| 876 | * is enabled, the parser will cache the grammars for re-use. If a grammar
|
---|
| 877 | * key is found in the pool, no caching of any grammar will take place.
|
---|
| 878 | *
|
---|
| 879 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 880 | *
|
---|
| 881 | * @param source A const reference to the SAX InputSource object which
|
---|
| 882 | * points to the schema grammar file to be preparsed.
|
---|
| 883 | * @param grammarType The grammar type (Schema or DTD).
|
---|
| 884 | * @param toCache If <code>true</code>, we cache the preparsed grammar,
|
---|
| 885 | * otherwise, no chaching. Default is <code>false</code>.
|
---|
| 886 | * @return The preparsed schema grammar object (SchemaGrammar or
|
---|
| 887 | * DTDGrammar). That grammar object is owned by the parser.
|
---|
| 888 | *
|
---|
| 889 | * @exception SAXException Any SAX exception, possibly
|
---|
| 890 | * wrapping another exception.
|
---|
| 891 | * @exception XMLException An exception from the parser or client
|
---|
| 892 | * handler code.
|
---|
| 893 | * @exception DOMException A DOM exception as per DOM spec.
|
---|
| 894 | *
|
---|
| 895 | * @see InputSource#InputSource
|
---|
| 896 | */
|
---|
| 897 | virtual Grammar* loadGrammar(const InputSource& source,
|
---|
| 898 | const short grammarType,
|
---|
| 899 | const bool toCache = false) = 0;
|
---|
| 900 |
|
---|
| 901 | /**
|
---|
| 902 | * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
|
---|
| 903 | *
|
---|
| 904 | * This method invokes the preparsing process on a schema grammar XML
|
---|
| 905 | * file specified by the file path parameter. If the 'toCache' flag
|
---|
| 906 | * is enabled, the parser will cache the grammars for re-use. If a grammar
|
---|
| 907 | * key is found in the pool, no caching of any grammar will take place.
|
---|
| 908 | *
|
---|
| 909 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 910 | *
|
---|
| 911 | * @param systemId A const XMLCh pointer to the Unicode string which
|
---|
| 912 | * contains the path to the XML grammar file to be
|
---|
| 913 | * preparsed.
|
---|
| 914 | * @param grammarType The grammar type (Schema or DTD).
|
---|
| 915 | * @param toCache If <code>true</code>, we cache the preparsed grammar,
|
---|
| 916 | * otherwise, no chaching. Default is <code>false</code>.
|
---|
| 917 | * @return The preparsed schema grammar object (SchemaGrammar or
|
---|
| 918 | * DTDGrammar). That grammar object is owned by the parser.
|
---|
| 919 | *
|
---|
| 920 | * @exception SAXException Any SAX exception, possibly
|
---|
| 921 | * wrapping another exception.
|
---|
| 922 | * @exception XMLException An exception from the parser or client
|
---|
| 923 | * handler code.
|
---|
| 924 | * @exception DOMException A DOM exception as per DOM spec.
|
---|
| 925 | */
|
---|
| 926 | virtual Grammar* loadGrammar(const XMLCh* const systemId,
|
---|
| 927 | const short grammarType,
|
---|
| 928 | const bool toCache = false) = 0;
|
---|
| 929 |
|
---|
| 930 | /**
|
---|
| 931 | * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
|
---|
| 932 | *
|
---|
| 933 | * This method invokes the preparsing process on a schema grammar XML
|
---|
| 934 | * file specified by the file path parameter. If the 'toCache' flag
|
---|
| 935 | * is enabled, the parser will cache the grammars for re-use. If a grammar
|
---|
| 936 | * key is found in the pool, no caching of any grammar will take place.
|
---|
| 937 | *
|
---|
| 938 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
| 939 | *
|
---|
| 940 | * @param systemId A const char pointer to a native string which contains
|
---|
| 941 | * the path to the XML grammar file to be preparsed.
|
---|
| 942 | * @param grammarType The grammar type (Schema or DTD).
|
---|
| 943 | * @param toCache If <code>true</code>, we cache the preparsed grammar,
|
---|
| 944 | * otherwise, no chaching. Default is <code>false</code>.
|
---|
| 945 | * @return The preparsed schema grammar object (SchemaGrammar or
|
---|
| 946 | * DTDGrammar). That grammar object is owned by the parser.
|
---|
| 947 | *
|
---|
| 948 | * @exception SAXException Any SAX exception, possibly
|
---|
| 949 | * wrapping another exception.
|
---|
| 950 | * @exception XMLException An exception from the parser or client
|
---|
| 951 | * handler code.
|
---|
| 952 | * @exception DOMException A DOM exception as per DOM spec.
|
---|
| 953 | */
|
---|
| 954 | virtual Grammar* loadGrammar(const char* const systemId,
|
---|
| 955 | const short grammarType,
|
---|
| 956 | const bool toCache = false) = 0;
|
---|
| 957 |
|
---|
| 958 | /**
|
---|
| 959 | * Clear the cached grammar pool
|
---|
| 960 | */
|
---|
| 961 | virtual void resetCachedGrammarPool() = 0;
|
---|
| 962 |
|
---|
| 963 | //@}
|
---|
| 964 |
|
---|
| 965 |
|
---|
| 966 | // -----------------------------------------------------------------------
|
---|
| 967 | // Advanced document handler list maintenance methods
|
---|
| 968 | // -----------------------------------------------------------------------
|
---|
| 969 |
|
---|
| 970 | /** @name Advanced document handler list maintenance methods */
|
---|
| 971 | //@{
|
---|
| 972 | /**
|
---|
| 973 | * This method installs the specified 'advanced' document callback
|
---|
| 974 | * handler, thereby allowing the user to customize the processing,
|
---|
| 975 | * if they choose to do so. Any number of advanced callback handlers
|
---|
| 976 | * maybe installed.
|
---|
| 977 | *
|
---|
| 978 | * <p>The methods in the advanced callback interface represent
|
---|
| 979 | * Xerces-C extensions. There is no specification for this interface.</p>
|
---|
| 980 | *
|
---|
| 981 | * @param toInstall A pointer to the users advanced callback handler.
|
---|
| 982 | *
|
---|
| 983 | * @see #removeAdvDocHandler
|
---|
| 984 | */
|
---|
| 985 | virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
|
---|
| 986 |
|
---|
| 987 | /**
|
---|
| 988 | * This method removes the 'advanced' document handler callback from
|
---|
| 989 | * the underlying parser scanner. If no handler is installed, advanced
|
---|
| 990 | * callbacks are not invoked by the scanner.
|
---|
| 991 | * @param toRemove A pointer to the advanced callback handler which
|
---|
| 992 | * should be removed.
|
---|
| 993 | *
|
---|
| 994 | * @see #installAdvDocHandler
|
---|
| 995 | */
|
---|
| 996 | virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
|
---|
| 997 | //@}
|
---|
| 998 |
|
---|
| 999 | private :
|
---|
| 1000 | /* The copy constructor, you cannot call this directly */
|
---|
| 1001 | SAX2XMLReader(const SAX2XMLReader&);
|
---|
| 1002 |
|
---|
| 1003 | /* The assignment operator, you cannot call this directly */
|
---|
| 1004 | SAX2XMLReader& operator=(const SAX2XMLReader&);
|
---|
| 1005 |
|
---|
| 1006 | };
|
---|
| 1007 |
|
---|
| 1008 | XERCES_CPP_NAMESPACE_END
|
---|
| 1009 |
|
---|
| 1010 | #endif
|
---|