parser/xml/public/nsISAXErrorHandler.idl

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsISAXLocator;
michael@0 9
michael@0 10 /**
michael@0 11 * Basic interface for SAX error handlers.
michael@0 12 *
michael@0 13 * If a SAX application needs to implement customized error
michael@0 14 * handling, it must implement this interface and then register an
michael@0 15 * instance with the XML reader. The parser will then report all
michael@0 16 * errors and warnings through this interface.
michael@0 17 *
michael@0 18 * WARNING: If an application does not register an ErrorHandler,
michael@0 19 * XML parsing errors will go unreported. In order to detect validity
michael@0 20 * errors, an ErrorHandler that does something with error() calls must
michael@0 21 * be registered.
michael@0 22 *
michael@0 23 */
michael@0 24 [scriptable, uuid(e02b6693-6cca-11da-be43-001422106990)]
michael@0 25 interface nsISAXErrorHandler: nsISupports {
michael@0 26
michael@0 27 /**
michael@0 28 * Receive notification of a recoverable error.
michael@0 29 *
michael@0 30 * This corresponds to the definition of "error" in section 1.2
michael@0 31 * of the W3C XML 1.0 Recommendation. For example, a validating
michael@0 32 * parser would use this callback to report the violation of a
michael@0 33 * validity constraint. The default behaviour is to take no
michael@0 34 * action.
michael@0 35 *
michael@0 36 * The SAX parser must continue to provide normal parsing events
michael@0 37 * after invoking this method: it should still be possible for the
michael@0 38 * application to process the document through to the end. If the
michael@0 39 * application cannot do so, then the parser should report a fatal
michael@0 40 * error even if the XML recommendation does not require it to do
michael@0 41 * so.
michael@0 42 *
michael@0 43 * Filters may use this method to report other, non-XML errors as
michael@0 44 * well.
michael@0 45 *
michael@0 46 * @param locator The locator object for the error (may be null).
michael@0 47 * @param error The error message.
michael@0 48 */
michael@0 49 void error(in nsISAXLocator locator, in AString error);
michael@0 50
michael@0 51 /**
michael@0 52 * Receive notification of a non-recoverable error.
michael@0 53 *
michael@0 54 * There is an apparent contradiction between the documentation
michael@0 55 * for this method and the documentation for
michael@0 56 * ContentHandler.endDocument(). Until this ambiguity is resolved in
michael@0 57 * a future major release, clients should make no assumptions about
michael@0 58 * whether endDocument() will or will not be invoked when the parser
michael@0 59 * has reported a fatalError() or thrown an exception.
michael@0 60 *
michael@0 61 * This corresponds to the definition of "fatal error" in section
michael@0 62 * 1.2 of the W3C XML 1.0 Recommendation. For example, a parser
michael@0 63 * would use this callback to report the violation of a
michael@0 64 * well-formedness constraint.
michael@0 65 *
michael@0 66 * The application must assume that the document is unusable
michael@0 67 * after the parser has invoked this method, and should continue (if
michael@0 68 * at all) only for the sake of collecting additional error
michael@0 69 * messages: in fact, SAX parsers are free to stop reporting any
michael@0 70 * other events once this method has been invoked.
michael@0 71 *
michael@0 72 * @param locator The locator object for the error (may be null).
michael@0 73 * @param error The error message.
michael@0 74 */
michael@0 75 void fatalError(in nsISAXLocator locator, in AString error);
michael@0 76
michael@0 77 /**
michael@0 78 * Receive notification of a warning.
michael@0 79 *
michael@0 80 * SAX parsers will use this method to report conditions that are
michael@0 81 * not errors or fatal errors as defined by the XML
michael@0 82 * recommendation. The default behaviour is to take no action.
michael@0 83 *
michael@0 84 * The SAX parser must continue to provide normal parsing events
michael@0 85 * after invoking this method: it should still be possible for the
michael@0 86 * application to process the document through to the end.
michael@0 87 *
michael@0 88 * Filters may use this method to report other, non-XML warnings
michael@0 89 * as well.
michael@0 90 *
michael@0 91 * @param locator The locator object for the warning (may be null).
michael@0 92 * @param error The warning message.
michael@0 93 */
michael@0 94 void ignorableWarning(in nsISAXLocator locator, in AString error);
michael@0 95 };

mercurial