[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2000 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: DefaultHandler.hpp,v $
|
---|
| 59 | * Revision 1.7 2004/01/29 11:46:32 cargilld
|
---|
| 60 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.6 2003/12/02 14:33:13 amassari
|
---|
| 63 | * Don't use the word "exception" as a variable name, as VC 7.1 complains about it
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.5 2002/11/04 14:55:45 tng
|
---|
| 66 | * C++ Namespace Support.
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.4 2002/08/20 16:53:56 tng
|
---|
| 69 | * [Bug 6251] Info during compilation.
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.3 2002/06/06 20:38:45 tng
|
---|
| 72 | * Document Fix: document that the returned object from resolveEntity is owned by the parser
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.2 2002/02/20 18:17:02 tng
|
---|
| 75 | * [Bug 5977] Warnings on generating apiDocs.
|
---|
| 76 | *
|
---|
| 77 | * Revision 1.1.1.1 2002/02/01 22:22:09 peiyongz
|
---|
| 78 | * sane_include
|
---|
| 79 | *
|
---|
| 80 | * Revision 1.6 2002/01/28 17:08:33 knoaman
|
---|
| 81 | * SAX2-ext's DeclHandler support.
|
---|
| 82 | *
|
---|
| 83 | * Revision 1.5 2001/11/13 13:24:05 tng
|
---|
| 84 | * Fix documentation for DefaultHandler.
|
---|
| 85 | *
|
---|
| 86 | * Revision 1.4 2000/12/22 15:17:01 tng
|
---|
| 87 | * SAX2-ext's LexicalHandler support added by David Bertoni.
|
---|
| 88 | *
|
---|
| 89 | * Revision 1.3 2000/08/14 18:56:14 aruna1
|
---|
| 90 | * Virtual parameter inconsistency fixed
|
---|
| 91 | *
|
---|
| 92 | * Revision 1.2 2000/08/07 18:21:27 jpolast
|
---|
| 93 | * change SAX_EXPORT module to SAX2_EXPORT
|
---|
| 94 | *
|
---|
| 95 | * Revision 1.1 2000/08/02 18:02:34 jpolast
|
---|
| 96 | * initial checkin of sax2 implementation
|
---|
| 97 | * submitted by Simon Fell (simon@fell.com)
|
---|
| 98 | * and Joe Polastre (jpolast@apache.org)
|
---|
| 99 | *
|
---|
| 100 | *
|
---|
| 101 | */
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | #ifndef DEFAULTHANDLER_HPP
|
---|
| 105 | #define DEFAULTHANDLER_HPP
|
---|
| 106 |
|
---|
| 107 | #include <xercesc/sax2/ContentHandler.hpp>
|
---|
| 108 | #include <xercesc/sax2/LexicalHandler.hpp>
|
---|
| 109 | #include <xercesc/sax2/DeclHandler.hpp>
|
---|
| 110 | #include <xercesc/sax/DTDHandler.hpp>
|
---|
| 111 | #include <xercesc/sax/EntityResolver.hpp>
|
---|
| 112 | #include <xercesc/sax/ErrorHandler.hpp>
|
---|
| 113 | #include <xercesc/sax/SAXParseException.hpp>
|
---|
| 114 |
|
---|
| 115 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 116 |
|
---|
| 117 | class Locator;
|
---|
| 118 | class Attributes;
|
---|
| 119 |
|
---|
| 120 | /**
|
---|
| 121 | * Default base class for SAX2 handlers.
|
---|
| 122 | *
|
---|
| 123 | * <p>This class implements the default behaviour for SAX2
|
---|
| 124 | * interfaces: EntityResolver, DTDHandler, ContentHandler,
|
---|
| 125 | * ErrorHandler, LexicalHandler, and DeclHandler.</p>
|
---|
| 126 | *
|
---|
| 127 | * <p>Application writers can extend this class when they need to
|
---|
| 128 | * implement only part of an interface; parser writers can
|
---|
| 129 | * instantiate this class to provide default handlers when the
|
---|
| 130 | * application has not supplied its own.</p>
|
---|
| 131 | *
|
---|
| 132 | * <p>Note that the use of this class is optional.</p>
|
---|
| 133 | *
|
---|
| 134 | * @see EntityResolver#EntityResolver
|
---|
| 135 | * @see DTDHandler#DTDHandler
|
---|
| 136 | * @see ContentHandler#ContentHandler
|
---|
| 137 | * @see ErrorHandler#ErrorHandler
|
---|
| 138 | * @see LexicalHandler#LexicalHandler
|
---|
| 139 | * @see DeclHandler#DeclHandler
|
---|
| 140 | */
|
---|
| 141 |
|
---|
| 142 | class SAX2_EXPORT DefaultHandler :
|
---|
| 143 |
|
---|
| 144 | public EntityResolver,
|
---|
| 145 | public DTDHandler,
|
---|
| 146 | public ContentHandler,
|
---|
| 147 | public ErrorHandler,
|
---|
| 148 | public LexicalHandler,
|
---|
| 149 | public DeclHandler
|
---|
| 150 | {
|
---|
| 151 | public:
|
---|
| 152 | /** @name Default handlers for the DocumentHandler interface */
|
---|
| 153 | //@{
|
---|
| 154 | /**
|
---|
| 155 | * Receive notification of character data inside an element.
|
---|
| 156 | *
|
---|
| 157 | * <p>By default, do nothing. Application writers may override this
|
---|
| 158 | * method to take specific actions for each chunk of character data
|
---|
| 159 | * (such as adding the data to a node or buffer, or printing it to
|
---|
| 160 | * a file).</p>
|
---|
| 161 | *
|
---|
| 162 | * @param chars The characters.
|
---|
| 163 | * @param length The number of characters to use from the
|
---|
| 164 | * character array.
|
---|
| 165 | * @exception SAXException Any SAX exception, possibly
|
---|
| 166 | * wrapping another exception.
|
---|
| 167 | * @see DocumentHandler#characters
|
---|
| 168 | */
|
---|
| 169 | virtual void characters
|
---|
| 170 | (
|
---|
| 171 | const XMLCh* const chars
|
---|
| 172 | , const unsigned int length
|
---|
| 173 | );
|
---|
| 174 |
|
---|
| 175 | /**
|
---|
| 176 | * Receive notification of the end of the document.
|
---|
| 177 | *
|
---|
| 178 | * <p>By default, do nothing. Application writers may override this
|
---|
| 179 | * method in a subclass to take specific actions at the beginning
|
---|
| 180 | * of a document (such as finalising a tree or closing an output
|
---|
| 181 | * file).</p>
|
---|
| 182 | *
|
---|
| 183 | * @exception SAXException Any SAX exception, possibly
|
---|
| 184 | * wrapping another exception.
|
---|
| 185 | * @see DocumentHandler#endDocument
|
---|
| 186 | */
|
---|
| 187 | virtual void endDocument();
|
---|
| 188 |
|
---|
| 189 | /**
|
---|
| 190 | * Receive notification of the end of an element.
|
---|
| 191 | *
|
---|
| 192 | * <p>By default, do nothing. Application writers may override this
|
---|
| 193 | * method in a subclass to take specific actions at the end of
|
---|
| 194 | * each element (such as finalising a tree node or writing
|
---|
| 195 | * output to a file).</p>
|
---|
| 196 | *
|
---|
| 197 | * @param uri The URI of the asscioated namespace for this element
|
---|
| 198 | * @param localname The local part of the element name
|
---|
| 199 | * @param qname The QName of this element
|
---|
| 200 | * @exception SAXException Any SAX exception, possibly
|
---|
| 201 | * wrapping another exception.
|
---|
| 202 | * @see DocumentHandler#endElement
|
---|
| 203 | */
|
---|
| 204 | virtual void endElement
|
---|
| 205 | (
|
---|
| 206 | const XMLCh* const uri,
|
---|
| 207 | const XMLCh* const localname,
|
---|
| 208 | const XMLCh* const qname
|
---|
| 209 | );
|
---|
| 210 |
|
---|
| 211 | /**
|
---|
| 212 | * Receive notification of ignorable whitespace in element content.
|
---|
| 213 | *
|
---|
| 214 | * <p>By default, do nothing. Application writers may override this
|
---|
| 215 | * method to take specific actions for each chunk of ignorable
|
---|
| 216 | * whitespace (such as adding data to a node or buffer, or printing
|
---|
| 217 | * it to a file).</p>
|
---|
| 218 | *
|
---|
| 219 | * @param chars The whitespace characters.
|
---|
| 220 | * @param length The number of characters to use from the
|
---|
| 221 | * character array.
|
---|
| 222 | * @exception SAXException Any SAX exception, possibly
|
---|
| 223 | * wrapping another exception.
|
---|
| 224 | * @see DocumentHandler#ignorableWhitespace
|
---|
| 225 | */
|
---|
| 226 | virtual void ignorableWhitespace
|
---|
| 227 | (
|
---|
| 228 | const XMLCh* const chars
|
---|
| 229 | , const unsigned int length
|
---|
| 230 | );
|
---|
| 231 |
|
---|
| 232 | /**
|
---|
| 233 | * Receive notification of a processing instruction.
|
---|
| 234 | *
|
---|
| 235 | * <p>By default, do nothing. Application writers may override this
|
---|
| 236 | * method in a subclass to take specific actions for each
|
---|
| 237 | * processing instruction, such as setting status variables or
|
---|
| 238 | * invoking other methods.</p>
|
---|
| 239 | *
|
---|
| 240 | * @param target The processing instruction target.
|
---|
| 241 | * @param data The processing instruction data, or null if
|
---|
| 242 | * none is supplied.
|
---|
| 243 | * @exception SAXException Any SAX exception, possibly
|
---|
| 244 | * wrapping another exception.
|
---|
| 245 | * @see DocumentHandler#processingInstruction
|
---|
| 246 | */
|
---|
| 247 | virtual void processingInstruction
|
---|
| 248 | (
|
---|
| 249 | const XMLCh* const target
|
---|
| 250 | , const XMLCh* const data
|
---|
| 251 | );
|
---|
| 252 |
|
---|
| 253 | /**
|
---|
| 254 | * Reset the Docuemnt object on its reuse
|
---|
| 255 | *
|
---|
| 256 | * @see DocumentHandler#resetDocument
|
---|
| 257 | */
|
---|
| 258 | virtual void resetDocument();
|
---|
| 259 | //@}
|
---|
| 260 |
|
---|
| 261 | /** @name Default implementation of DocumentHandler interface */
|
---|
| 262 |
|
---|
| 263 | //@{
|
---|
| 264 | /**
|
---|
| 265 | * Receive a Locator object for document events.
|
---|
| 266 | *
|
---|
| 267 | * <p>By default, do nothing. Application writers may override this
|
---|
| 268 | * method in a subclass if they wish to store the locator for use
|
---|
| 269 | * with other document events.</p>
|
---|
| 270 | *
|
---|
| 271 | * @param locator A locator for all SAX document events.
|
---|
| 272 | * @see DocumentHandler#setDocumentLocator
|
---|
| 273 | * @see Locator
|
---|
| 274 | */
|
---|
| 275 | virtual void setDocumentLocator(const Locator* const locator);
|
---|
| 276 |
|
---|
| 277 | /**
|
---|
| 278 | * Receive notification of the beginning of the document.
|
---|
| 279 | *
|
---|
| 280 | * <p>By default, do nothing. Application writers may override this
|
---|
| 281 | * method in a subclass to take specific actions at the beginning
|
---|
| 282 | * of a document (such as allocating the root node of a tree or
|
---|
| 283 | * creating an output file).</p>
|
---|
| 284 | *
|
---|
| 285 | * @exception SAXException Any SAX exception, possibly
|
---|
| 286 | * wrapping another exception.
|
---|
| 287 | * @see DocumentHandler#startDocument
|
---|
| 288 | */
|
---|
| 289 | virtual void startDocument();
|
---|
| 290 |
|
---|
| 291 | /**
|
---|
| 292 | * Receive notification of the start of an element.
|
---|
| 293 | *
|
---|
| 294 | * <p>By default, do nothing. Application writers may override this
|
---|
| 295 | * method in a subclass to take specific actions at the start of
|
---|
| 296 | * each element (such as allocating a new tree node or writing
|
---|
| 297 | * output to a file).</p>
|
---|
| 298 | *
|
---|
| 299 | * @param uri The URI of the asscioated namespace for this element
|
---|
| 300 | * @param localname the local part of the element name
|
---|
| 301 | * @param qname the QName of this element
|
---|
| 302 | * @param attrs The specified or defaulted attributes.
|
---|
| 303 | * @exception SAXException Any SAX exception, possibly
|
---|
| 304 | * wrapping another exception.
|
---|
| 305 | * @see DocumentHandler#startElement
|
---|
| 306 | */
|
---|
| 307 | virtual void startElement
|
---|
| 308 | (
|
---|
| 309 | const XMLCh* const uri,
|
---|
| 310 | const XMLCh* const localname,
|
---|
| 311 | const XMLCh* const qname
|
---|
| 312 | , const Attributes& attrs
|
---|
| 313 | );
|
---|
| 314 |
|
---|
| 315 | /**
|
---|
| 316 | * Receive notification of the start of an namespace prefix mapping.
|
---|
| 317 | *
|
---|
| 318 | * <p>By default, do nothing. Application writers may override this
|
---|
| 319 | * method in a subclass to take specific actions at the start of
|
---|
| 320 | * each namespace prefix mapping.</p>
|
---|
| 321 | *
|
---|
| 322 | * NOTE : The current Implementation of SAX2Parser will _NEVER_ call this
|
---|
| 323 | *
|
---|
| 324 | * @param prefix The namespace prefix used
|
---|
| 325 | * @param uri The namespace URI used.
|
---|
| 326 | * @exception SAXException Any SAX exception, possibly
|
---|
| 327 | * wrapping another exception.
|
---|
| 328 | * @see DocumentHandler#startPrefixMapping
|
---|
| 329 | */
|
---|
| 330 | virtual void startPrefixMapping
|
---|
| 331 | (
|
---|
| 332 | const XMLCh* const prefix,
|
---|
| 333 | const XMLCh* const uri
|
---|
| 334 | ) ;
|
---|
| 335 |
|
---|
| 336 | /**
|
---|
| 337 | * Receive notification of the end of an namespace prefix mapping.
|
---|
| 338 | *
|
---|
| 339 | * <p>By default, do nothing. Application writers may override this
|
---|
| 340 | * method in a subclass to take specific actions at the end of
|
---|
| 341 | * each namespace prefix mapping.</p>
|
---|
| 342 | *
|
---|
| 343 | * NOTE : The current Implementation of SAX2Parser will _NEVER_ call this
|
---|
| 344 | *
|
---|
| 345 | * @param prefix The namespace prefix used
|
---|
| 346 | * @exception SAXException Any SAX exception, possibly
|
---|
| 347 | * wrapping another exception.
|
---|
| 348 | * @see DocumentHandler#endPrefixMapping
|
---|
| 349 | */
|
---|
| 350 | virtual void endPrefixMapping
|
---|
| 351 | (
|
---|
| 352 | const XMLCh* const prefix
|
---|
| 353 | ) ;
|
---|
| 354 |
|
---|
| 355 | /**
|
---|
| 356 | * Receive notification of a skipped entity
|
---|
| 357 | *
|
---|
| 358 | * <p>The parser will invoke this method once for each entity
|
---|
| 359 | * skipped. All processors may skip external entities,
|
---|
| 360 | * depending on the values of the features:<br>
|
---|
| 361 | * http://xml.org/sax/features/external-general-entities<br>
|
---|
| 362 | * http://xml.org/sax/features/external-parameter-entities</p>
|
---|
| 363 | *
|
---|
| 364 | * <p>Introduced with SAX2</p>
|
---|
| 365 | *
|
---|
| 366 | * @param name The name of the skipped entity. If it is a parameter entity,
|
---|
| 367 | * the name will begin with %, and if it is the external DTD subset,
|
---|
| 368 | * it will be the string [dtd].
|
---|
| 369 | * @exception SAXException Any SAX exception, possibly
|
---|
| 370 | * wrapping another exception.
|
---|
| 371 | */
|
---|
| 372 | virtual void skippedEntity
|
---|
| 373 | (
|
---|
| 374 | const XMLCh* const name
|
---|
| 375 | ) ;
|
---|
| 376 |
|
---|
| 377 | //@}
|
---|
| 378 |
|
---|
| 379 | /** @name Default implementation of the EntityResolver interface. */
|
---|
| 380 |
|
---|
| 381 | //@{
|
---|
| 382 | /**
|
---|
| 383 | * Resolve an external entity.
|
---|
| 384 | *
|
---|
| 385 | * <p>Always return null, so that the parser will use the system
|
---|
| 386 | * identifier provided in the XML document. This method implements
|
---|
| 387 | * the SAX default behaviour: application writers can override it
|
---|
| 388 | * in a subclass to do special translations such as catalog lookups
|
---|
| 389 | * or URI redirection.</p>
|
---|
| 390 | *
|
---|
| 391 | * @param publicId The public identifer, or null if none is
|
---|
| 392 | * available.
|
---|
| 393 | * @param systemId The system identifier provided in the XML
|
---|
| 394 | * document.
|
---|
| 395 | * @return The new input source, or null to require the
|
---|
| 396 | * default behaviour.
|
---|
| 397 | * The returned InputSource is owned by the parser which is
|
---|
| 398 | * responsible to clean up the memory.
|
---|
| 399 | * @exception SAXException Any SAX exception, possibly
|
---|
| 400 | * wrapping another exception.
|
---|
| 401 | * @see EntityResolver#resolveEntity
|
---|
| 402 | */
|
---|
| 403 | virtual InputSource* resolveEntity
|
---|
| 404 | (
|
---|
| 405 | const XMLCh* const publicId
|
---|
| 406 | , const XMLCh* const systemId
|
---|
| 407 | );
|
---|
| 408 |
|
---|
| 409 | //@}
|
---|
| 410 |
|
---|
| 411 | /** @name Default implementation of the ErrorHandler interface */
|
---|
| 412 | //@{
|
---|
| 413 | /**
|
---|
| 414 | * Receive notification of a recoverable parser error.
|
---|
| 415 | *
|
---|
| 416 | * <p>The default implementation does nothing. Application writers
|
---|
| 417 | * may override this method in a subclass to take specific actions
|
---|
| 418 | * for each error, such as inserting the message in a log file or
|
---|
| 419 | * printing it to the console.</p>
|
---|
| 420 | *
|
---|
| 421 | * @param exc The warning information encoded as an exception.
|
---|
| 422 | * @exception SAXException Any SAX exception, possibly
|
---|
| 423 | * wrapping another exception.
|
---|
| 424 | * @see ErrorHandler#warning
|
---|
| 425 | * @see SAXParseException#SAXParseException
|
---|
| 426 | */
|
---|
| 427 | virtual void error(const SAXParseException& exc);
|
---|
| 428 |
|
---|
| 429 | /**
|
---|
| 430 | * Report a fatal XML parsing error.
|
---|
| 431 | *
|
---|
| 432 | * <p>The default implementation throws a SAXParseException.
|
---|
| 433 | * Application writers may override this method in a subclass if
|
---|
| 434 | * they need to take specific actions for each fatal error (such as
|
---|
| 435 | * collecting all of the errors into a single report): in any case,
|
---|
| 436 | * the application must stop all regular processing when this
|
---|
| 437 | * method is invoked, since the document is no longer reliable, and
|
---|
| 438 | * the parser may no longer report parsing events.</p>
|
---|
| 439 | *
|
---|
| 440 | * @param exc The error information encoded as an exception.
|
---|
| 441 | * @exception SAXException Any SAX exception, possibly
|
---|
| 442 | * wrapping another exception.
|
---|
| 443 | * @see ErrorHandler#fatalError
|
---|
| 444 | * @see SAXParseException#SAXParseException
|
---|
| 445 | */
|
---|
| 446 | virtual void fatalError(const SAXParseException& exc);
|
---|
| 447 |
|
---|
| 448 | /**
|
---|
| 449 | * Receive notification of a parser warning.
|
---|
| 450 | *
|
---|
| 451 | * <p>The default implementation does nothing. Application writers
|
---|
| 452 | * may override this method in a subclass to take specific actions
|
---|
| 453 | * for each warning, such as inserting the message in a log file or
|
---|
| 454 | * printing it to the console.</p>
|
---|
| 455 | *
|
---|
| 456 | * @param exc The warning information encoded as an exception.
|
---|
| 457 | * @exception SAXException Any SAX exception, possibly
|
---|
| 458 | * wrapping another exception.
|
---|
| 459 | * @see ErrorHandler#warning
|
---|
| 460 | * @see SAXParseException#SAXParseException
|
---|
| 461 | */
|
---|
| 462 | virtual void warning(const SAXParseException& exc);
|
---|
| 463 |
|
---|
| 464 | /**
|
---|
| 465 | * Reset the Error handler object on its reuse
|
---|
| 466 | *
|
---|
| 467 | * @see ErrorHandler#resetErrors
|
---|
| 468 | */
|
---|
| 469 | virtual void resetErrors();
|
---|
| 470 |
|
---|
| 471 | //@}
|
---|
| 472 |
|
---|
| 473 |
|
---|
| 474 | /** @name Default implementation of DTDHandler interface. */
|
---|
| 475 | //@{
|
---|
| 476 |
|
---|
| 477 | /**
|
---|
| 478 | * Receive notification of a notation declaration.
|
---|
| 479 | *
|
---|
| 480 | * <p>By default, do nothing. Application writers may override this
|
---|
| 481 | * method in a subclass if they wish to keep track of the notations
|
---|
| 482 | * declared in a document.</p>
|
---|
| 483 | *
|
---|
| 484 | * @param name The notation name.
|
---|
| 485 | * @param publicId The notation public identifier, or null if not
|
---|
| 486 | * available.
|
---|
| 487 | * @param systemId The notation system identifier.
|
---|
| 488 | * @see DTDHandler#notationDecl
|
---|
| 489 | */
|
---|
| 490 | virtual void notationDecl
|
---|
| 491 | (
|
---|
| 492 | const XMLCh* const name
|
---|
| 493 | , const XMLCh* const publicId
|
---|
| 494 | , const XMLCh* const systemId
|
---|
| 495 | );
|
---|
| 496 |
|
---|
| 497 | /**
|
---|
| 498 | * Reset the DTD object on its reuse
|
---|
| 499 | *
|
---|
| 500 | * @see DTDHandler#resetDocType
|
---|
| 501 | */
|
---|
| 502 | virtual void resetDocType();
|
---|
| 503 |
|
---|
| 504 | /**
|
---|
| 505 | * Receive notification of an unparsed entity declaration.
|
---|
| 506 | *
|
---|
| 507 | * <p>By default, do nothing. Application writers may override this
|
---|
| 508 | * method in a subclass to keep track of the unparsed entities
|
---|
| 509 | * declared in a document.</p>
|
---|
| 510 | *
|
---|
| 511 | * @param name The entity name.
|
---|
| 512 | * @param publicId The entity public identifier, or null if not
|
---|
| 513 | * available.
|
---|
| 514 | * @param systemId The entity system identifier.
|
---|
| 515 | * @param notationName The name of the associated notation.
|
---|
| 516 | * @see DTDHandler#unparsedEntityDecl
|
---|
| 517 | */
|
---|
| 518 | virtual void unparsedEntityDecl
|
---|
| 519 | (
|
---|
| 520 | const XMLCh* const name
|
---|
| 521 | , const XMLCh* const publicId
|
---|
| 522 | , const XMLCh* const systemId
|
---|
| 523 | , const XMLCh* const notationName
|
---|
| 524 | );
|
---|
| 525 | //@}
|
---|
| 526 |
|
---|
| 527 |
|
---|
| 528 | /** @name Default implementation of LexicalHandler interface. */
|
---|
| 529 |
|
---|
| 530 | //@{
|
---|
| 531 | /**
|
---|
| 532 | * Receive notification of comments.
|
---|
| 533 | *
|
---|
| 534 | * <p>The Parser will call this method to report each occurence of
|
---|
| 535 | * a comment in the XML document.</p>
|
---|
| 536 | *
|
---|
| 537 | * <p>The application must not attempt to read from the array
|
---|
| 538 | * outside of the specified range.</p>
|
---|
| 539 | *
|
---|
| 540 | * @param chars The characters from the XML document.
|
---|
| 541 | * @param length The number of characters to read from the array.
|
---|
| 542 | * @exception SAXException Any SAX exception, possibly
|
---|
| 543 | * wrapping another exception.
|
---|
| 544 | */
|
---|
| 545 | virtual void comment
|
---|
| 546 | (
|
---|
| 547 | const XMLCh* const chars
|
---|
| 548 | , const unsigned int length
|
---|
| 549 | );
|
---|
| 550 |
|
---|
| 551 | /**
|
---|
| 552 | * Receive notification of the end of a CDATA section.
|
---|
| 553 | *
|
---|
| 554 | * <p>The SAX parser will invoke this method at the end of
|
---|
| 555 | * each CDATA parsed.</p>
|
---|
| 556 | *
|
---|
| 557 | * @exception SAXException Any SAX exception, possibly
|
---|
| 558 | * wrapping another exception.
|
---|
| 559 | */
|
---|
| 560 | virtual void endCDATA ();
|
---|
| 561 |
|
---|
| 562 | /**
|
---|
| 563 | * Receive notification of the end of the DTD declarations.
|
---|
| 564 | *
|
---|
| 565 | * <p>The SAX parser will invoke this method at the end of the
|
---|
| 566 | * DTD</p>
|
---|
| 567 | *
|
---|
| 568 | * @exception SAXException Any SAX exception, possibly
|
---|
| 569 | * wrapping another exception.
|
---|
| 570 | */
|
---|
| 571 | virtual void endDTD ();
|
---|
| 572 |
|
---|
| 573 | /**
|
---|
| 574 | * Receive notification of the end of an entity.
|
---|
| 575 | *
|
---|
| 576 | * <p>The SAX parser will invoke this method at the end of an
|
---|
| 577 | * entity</p>
|
---|
| 578 | *
|
---|
| 579 | * @param name The name of the entity that is ending.
|
---|
| 580 | * @exception SAXException Any SAX exception, possibly
|
---|
| 581 | * wrapping another exception.
|
---|
| 582 | */
|
---|
| 583 | virtual void endEntity (const XMLCh* const name);
|
---|
| 584 |
|
---|
| 585 | /**
|
---|
| 586 | * Receive notification of the start of a CDATA section.
|
---|
| 587 | *
|
---|
| 588 | * <p>The SAX parser will invoke this method at the start of
|
---|
| 589 | * each CDATA parsed.</p>
|
---|
| 590 | *
|
---|
| 591 | * @exception SAXException Any SAX exception, possibly
|
---|
| 592 | * wrapping another exception.
|
---|
| 593 | */
|
---|
| 594 | virtual void startCDATA ();
|
---|
| 595 |
|
---|
| 596 | /**
|
---|
| 597 | * Receive notification of the start of the DTD declarations.
|
---|
| 598 | *
|
---|
| 599 | * <p>The SAX parser will invoke this method at the start of the
|
---|
| 600 | * DTD</p>
|
---|
| 601 | *
|
---|
| 602 | * @param name The document type name.
|
---|
| 603 | * @param publicId The declared public identifier for the external DTD subset, or null if none was declared.
|
---|
| 604 | * @param systemId The declared system identifier for the external DTD subset, or null if none was declared.
|
---|
| 605 | * @exception SAXException Any SAX exception, possibly
|
---|
| 606 | * wrapping another exception.
|
---|
| 607 | */
|
---|
| 608 | virtual void startDTD
|
---|
| 609 | (
|
---|
| 610 | const XMLCh* const name
|
---|
| 611 | , const XMLCh* const publicId
|
---|
| 612 | , const XMLCh* const systemId
|
---|
| 613 | );
|
---|
| 614 |
|
---|
| 615 | /**
|
---|
| 616 | * Receive notification of the start of an entity.
|
---|
| 617 | *
|
---|
| 618 | * <p>The SAX parser will invoke this method at the start of an
|
---|
| 619 | * entity</p>
|
---|
| 620 | *
|
---|
| 621 | * @param name The name of the entity that is starting.
|
---|
| 622 | * @exception SAXException Any SAX exception, possibly
|
---|
| 623 | * wrapping another exception.
|
---|
| 624 | */
|
---|
| 625 | virtual void startEntity (const XMLCh* const name);
|
---|
| 626 |
|
---|
| 627 | //@}
|
---|
| 628 |
|
---|
| 629 | /** @name Default implementation of DeclHandler interface. */
|
---|
| 630 |
|
---|
| 631 | //@{
|
---|
| 632 |
|
---|
| 633 | /**
|
---|
| 634 | * Report an element type declaration.
|
---|
| 635 | *
|
---|
| 636 | * <p>The content model will consist of the string "EMPTY", the string
|
---|
| 637 | * "ANY", or a parenthesised group, optionally followed by an occurrence
|
---|
| 638 | * indicator. The model will be normalized so that all parameter entities
|
---|
| 639 | * are fully resolved and all whitespace is removed,and will include the
|
---|
| 640 | * enclosing parentheses. Other normalization (such as removing redundant
|
---|
| 641 | * parentheses or simplifying occurrence indicators) is at the discretion
|
---|
| 642 | * of the parser.</p>
|
---|
| 643 | *
|
---|
| 644 | * @param name The element type name.
|
---|
| 645 | * @param model The content model as a normalized string.
|
---|
| 646 | * @exception SAXException Any SAX exception, possibly
|
---|
| 647 | * wrapping another exception.
|
---|
| 648 | */
|
---|
| 649 | virtual void elementDecl
|
---|
| 650 | (
|
---|
| 651 | const XMLCh* const name
|
---|
| 652 | , const XMLCh* const model
|
---|
| 653 | );
|
---|
| 654 |
|
---|
| 655 | /**
|
---|
| 656 | * Report an attribute type declaration.
|
---|
| 657 | *
|
---|
| 658 | * <p>Only the effective (first) declaration for an attribute will
|
---|
| 659 | * be reported.</p>
|
---|
| 660 | *
|
---|
| 661 | * @param eName The name of the associated element.
|
---|
| 662 | * @param aName The name of the attribute.
|
---|
| 663 | * @param type A string representing the attribute type.
|
---|
| 664 | * @param mode A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
|
---|
| 665 | * @param value A string representing the attribute's default value, or null if there is none.
|
---|
| 666 | * @exception SAXException Any SAX exception, possibly
|
---|
| 667 | * wrapping another exception.
|
---|
| 668 | */
|
---|
| 669 | virtual void attributeDecl
|
---|
| 670 | (
|
---|
| 671 | const XMLCh* const eName
|
---|
| 672 | , const XMLCh* const aName
|
---|
| 673 | , const XMLCh* const type
|
---|
| 674 | , const XMLCh* const mode
|
---|
| 675 | , const XMLCh* const value
|
---|
| 676 | );
|
---|
| 677 |
|
---|
| 678 | /**
|
---|
| 679 | * Report an internal entity declaration.
|
---|
| 680 | *
|
---|
| 681 | * <p>Only the effective (first) declaration for each entity will be
|
---|
| 682 | * reported. All parameter entities in the value will be expanded, but
|
---|
| 683 | * general entities will not.</p>
|
---|
| 684 | *
|
---|
| 685 | * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'.
|
---|
| 686 | * @param value The replacement text of the entity.
|
---|
| 687 | * @exception SAXException Any SAX exception, possibly
|
---|
| 688 | * wrapping another exception.
|
---|
| 689 | */
|
---|
| 690 | virtual void internalEntityDecl
|
---|
| 691 | (
|
---|
| 692 | const XMLCh* const name
|
---|
| 693 | , const XMLCh* const value
|
---|
| 694 | );
|
---|
| 695 |
|
---|
| 696 | /**
|
---|
| 697 | * Report a parsed external entity declaration.
|
---|
| 698 | *
|
---|
| 699 | * <p>Only the effective (first) declaration for each entity will
|
---|
| 700 | * be reported.</p>
|
---|
| 701 | *
|
---|
| 702 | * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'.
|
---|
| 703 | * @param publicId The The declared public identifier of the entity, or null if none was declared.
|
---|
| 704 | * @param systemId The declared system identifier of the entity.
|
---|
| 705 | * @exception SAXException Any SAX exception, possibly
|
---|
| 706 | * wrapping another exception.
|
---|
| 707 | */
|
---|
| 708 | virtual void externalEntityDecl
|
---|
| 709 | (
|
---|
| 710 | const XMLCh* const name
|
---|
| 711 | , const XMLCh* const publicId
|
---|
| 712 | , const XMLCh* const systemId
|
---|
| 713 | );
|
---|
| 714 |
|
---|
| 715 | //@}
|
---|
| 716 |
|
---|
| 717 | DefaultHandler() {};
|
---|
| 718 | virtual ~DefaultHandler() {};
|
---|
| 719 |
|
---|
| 720 | private:
|
---|
| 721 | // -----------------------------------------------------------------------
|
---|
| 722 | // Unimplemented constructors and operators
|
---|
| 723 | // -----------------------------------------------------------------------
|
---|
| 724 | DefaultHandler(const DefaultHandler&);
|
---|
| 725 | DefaultHandler& operator=(const DefaultHandler&);
|
---|
| 726 | };
|
---|
| 727 |
|
---|
| 728 |
|
---|
| 729 | // ---------------------------------------------------------------------------
|
---|
| 730 | // HandlerBase: Inline default implementations
|
---|
| 731 | // ---------------------------------------------------------------------------
|
---|
| 732 | inline void DefaultHandler::characters(const XMLCh* const
|
---|
| 733 | ,const unsigned int)
|
---|
| 734 | {
|
---|
| 735 | }
|
---|
| 736 |
|
---|
| 737 | inline void DefaultHandler::endDocument()
|
---|
| 738 | {
|
---|
| 739 | }
|
---|
| 740 |
|
---|
| 741 | inline void DefaultHandler::endElement(const XMLCh* const
|
---|
| 742 | , const XMLCh* const
|
---|
| 743 | , const XMLCh* const)
|
---|
| 744 | {
|
---|
| 745 | }
|
---|
| 746 |
|
---|
| 747 | inline void DefaultHandler::error(const SAXParseException&)
|
---|
| 748 | {
|
---|
| 749 | }
|
---|
| 750 |
|
---|
| 751 | inline void DefaultHandler::fatalError(const SAXParseException& exc)
|
---|
| 752 | {
|
---|
| 753 | throw exc;
|
---|
| 754 | }
|
---|
| 755 |
|
---|
| 756 | inline void
|
---|
| 757 | DefaultHandler::ignorableWhitespace( const XMLCh* const
|
---|
| 758 | , const unsigned int)
|
---|
| 759 | {
|
---|
| 760 | }
|
---|
| 761 |
|
---|
| 762 | inline void DefaultHandler::notationDecl( const XMLCh* const
|
---|
| 763 | , const XMLCh* const
|
---|
| 764 | , const XMLCh* const)
|
---|
| 765 | {
|
---|
| 766 | }
|
---|
| 767 |
|
---|
| 768 | inline void
|
---|
| 769 | DefaultHandler::processingInstruction( const XMLCh* const
|
---|
| 770 | , const XMLCh* const)
|
---|
| 771 | {
|
---|
| 772 | }
|
---|
| 773 |
|
---|
| 774 | inline void DefaultHandler::resetErrors()
|
---|
| 775 | {
|
---|
| 776 | }
|
---|
| 777 |
|
---|
| 778 | inline void DefaultHandler::resetDocument()
|
---|
| 779 | {
|
---|
| 780 | }
|
---|
| 781 |
|
---|
| 782 | inline void DefaultHandler::resetDocType()
|
---|
| 783 | {
|
---|
| 784 | }
|
---|
| 785 |
|
---|
| 786 | inline InputSource*
|
---|
| 787 | DefaultHandler::resolveEntity( const XMLCh* const
|
---|
| 788 | , const XMLCh* const)
|
---|
| 789 | {
|
---|
| 790 | return 0;
|
---|
| 791 | }
|
---|
| 792 |
|
---|
| 793 | inline void
|
---|
| 794 | DefaultHandler::unparsedEntityDecl(const XMLCh* const
|
---|
| 795 | , const XMLCh* const
|
---|
| 796 | , const XMLCh* const
|
---|
| 797 | , const XMLCh* const)
|
---|
| 798 | {
|
---|
| 799 | }
|
---|
| 800 |
|
---|
| 801 | inline void DefaultHandler::setDocumentLocator(const Locator* const)
|
---|
| 802 | {
|
---|
| 803 | }
|
---|
| 804 |
|
---|
| 805 | inline void DefaultHandler::startDocument()
|
---|
| 806 | {
|
---|
| 807 | }
|
---|
| 808 |
|
---|
| 809 | inline void
|
---|
| 810 | DefaultHandler::startElement( const XMLCh* const
|
---|
| 811 | , const XMLCh* const
|
---|
| 812 | , const XMLCh* const
|
---|
| 813 | , const Attributes&
|
---|
| 814 | )
|
---|
| 815 | {
|
---|
| 816 | }
|
---|
| 817 |
|
---|
| 818 | inline void DefaultHandler::warning(const SAXParseException&)
|
---|
| 819 | {
|
---|
| 820 | }
|
---|
| 821 |
|
---|
| 822 | inline void DefaultHandler::startPrefixMapping ( const XMLCh* const
|
---|
| 823 | ,const XMLCh* const)
|
---|
| 824 | {
|
---|
| 825 | }
|
---|
| 826 |
|
---|
| 827 | inline void DefaultHandler::endPrefixMapping ( const XMLCh* const)
|
---|
| 828 | {
|
---|
| 829 | }
|
---|
| 830 |
|
---|
| 831 | inline void DefaultHandler::skippedEntity ( const XMLCh* const)
|
---|
| 832 | {
|
---|
| 833 | }
|
---|
| 834 |
|
---|
| 835 | inline void DefaultHandler::comment( const XMLCh* const
|
---|
| 836 | , const unsigned int)
|
---|
| 837 | {
|
---|
| 838 | }
|
---|
| 839 |
|
---|
| 840 | inline void DefaultHandler::endCDATA ()
|
---|
| 841 | {
|
---|
| 842 | }
|
---|
| 843 |
|
---|
| 844 | inline void DefaultHandler::endDTD ()
|
---|
| 845 | {
|
---|
| 846 | }
|
---|
| 847 |
|
---|
| 848 | inline void DefaultHandler::endEntity (const XMLCh* const)
|
---|
| 849 | {
|
---|
| 850 | }
|
---|
| 851 |
|
---|
| 852 | inline void DefaultHandler::startCDATA ()
|
---|
| 853 | {
|
---|
| 854 | }
|
---|
| 855 |
|
---|
| 856 | inline void DefaultHandler::startDTD( const XMLCh* const
|
---|
| 857 | , const XMLCh* const
|
---|
| 858 | , const XMLCh* const)
|
---|
| 859 | {
|
---|
| 860 | }
|
---|
| 861 |
|
---|
| 862 | inline void DefaultHandler::startEntity (const XMLCh* const)
|
---|
| 863 | {
|
---|
| 864 | }
|
---|
| 865 |
|
---|
| 866 | inline void DefaultHandler::attributeDecl(const XMLCh* const,
|
---|
| 867 | const XMLCh* const,
|
---|
| 868 | const XMLCh* const,
|
---|
| 869 | const XMLCh* const,
|
---|
| 870 | const XMLCh* const)
|
---|
| 871 | {
|
---|
| 872 | }
|
---|
| 873 |
|
---|
| 874 | inline void DefaultHandler::elementDecl(const XMLCh* const,
|
---|
| 875 | const XMLCh* const)
|
---|
| 876 | {
|
---|
| 877 | }
|
---|
| 878 |
|
---|
| 879 | inline void DefaultHandler::externalEntityDecl(const XMLCh* const,
|
---|
| 880 | const XMLCh* const,
|
---|
| 881 | const XMLCh* const)
|
---|
| 882 | {
|
---|
| 883 | }
|
---|
| 884 |
|
---|
| 885 | inline void DefaultHandler::internalEntityDecl(const XMLCh* const,
|
---|
| 886 | const XMLCh* const)
|
---|
| 887 | {
|
---|
| 888 | }
|
---|
| 889 |
|
---|
| 890 | XERCES_CPP_NAMESPACE_END
|
---|
| 891 |
|
---|
| 892 | #endif // ! DEFAULTHANDLER_HPP
|
---|