michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsISAXLocator; michael@0: michael@0: /** michael@0: * Basic interface for SAX error handlers. michael@0: * michael@0: * If a SAX application needs to implement customized error michael@0: * handling, it must implement this interface and then register an michael@0: * instance with the XML reader. The parser will then report all michael@0: * errors and warnings through this interface. michael@0: * michael@0: * WARNING: If an application does not register an ErrorHandler, michael@0: * XML parsing errors will go unreported. In order to detect validity michael@0: * errors, an ErrorHandler that does something with error() calls must michael@0: * be registered. michael@0: * michael@0: */ michael@0: [scriptable, uuid(e02b6693-6cca-11da-be43-001422106990)] michael@0: interface nsISAXErrorHandler: nsISupports { michael@0: michael@0: /** michael@0: * Receive notification of a recoverable error. michael@0: * michael@0: * This corresponds to the definition of "error" in section 1.2 michael@0: * of the W3C XML 1.0 Recommendation. For example, a validating michael@0: * parser would use this callback to report the violation of a michael@0: * validity constraint. The default behaviour is to take no michael@0: * action. michael@0: * michael@0: * The SAX parser must continue to provide normal parsing events michael@0: * after invoking this method: it should still be possible for the michael@0: * application to process the document through to the end. If the michael@0: * application cannot do so, then the parser should report a fatal michael@0: * error even if the XML recommendation does not require it to do michael@0: * so. michael@0: * michael@0: * Filters may use this method to report other, non-XML errors as michael@0: * well. michael@0: * michael@0: * @param locator The locator object for the error (may be null). michael@0: * @param error The error message. michael@0: */ michael@0: void error(in nsISAXLocator locator, in AString error); michael@0: michael@0: /** michael@0: * Receive notification of a non-recoverable error. michael@0: * michael@0: * There is an apparent contradiction between the documentation michael@0: * for this method and the documentation for michael@0: * ContentHandler.endDocument(). Until this ambiguity is resolved in michael@0: * a future major release, clients should make no assumptions about michael@0: * whether endDocument() will or will not be invoked when the parser michael@0: * has reported a fatalError() or thrown an exception. michael@0: * michael@0: * This corresponds to the definition of "fatal error" in section michael@0: * 1.2 of the W3C XML 1.0 Recommendation. For example, a parser michael@0: * would use this callback to report the violation of a michael@0: * well-formedness constraint. michael@0: * michael@0: * The application must assume that the document is unusable michael@0: * after the parser has invoked this method, and should continue (if michael@0: * at all) only for the sake of collecting additional error michael@0: * messages: in fact, SAX parsers are free to stop reporting any michael@0: * other events once this method has been invoked. michael@0: * michael@0: * @param locator The locator object for the error (may be null). michael@0: * @param error The error message. michael@0: */ michael@0: void fatalError(in nsISAXLocator locator, in AString error); michael@0: michael@0: /** michael@0: * Receive notification of a warning. michael@0: * michael@0: * SAX parsers will use this method to report conditions that are michael@0: * not errors or fatal errors as defined by the XML michael@0: * recommendation. The default behaviour is to take no action. michael@0: * michael@0: * The SAX parser must continue to provide normal parsing events michael@0: * after invoking this method: it should still be possible for the michael@0: * application to process the document through to the end. michael@0: * michael@0: * Filters may use this method to report other, non-XML warnings michael@0: * as well. michael@0: * michael@0: * @param locator The locator object for the warning (may be null). michael@0: * @param error The warning message. michael@0: */ michael@0: void ignorableWarning(in nsISAXLocator locator, in AString error); michael@0: };