1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/parser/xml/public/nsISAXErrorHandler.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,95 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsISAXLocator; 1.12 + 1.13 +/** 1.14 + * Basic interface for SAX error handlers. 1.15 + * 1.16 + * If a SAX application needs to implement customized error 1.17 + * handling, it must implement this interface and then register an 1.18 + * instance with the XML reader. The parser will then report all 1.19 + * errors and warnings through this interface. 1.20 + * 1.21 + * WARNING: If an application does not register an ErrorHandler, 1.22 + * XML parsing errors will go unreported. In order to detect validity 1.23 + * errors, an ErrorHandler that does something with error() calls must 1.24 + * be registered. 1.25 + * 1.26 + */ 1.27 +[scriptable, uuid(e02b6693-6cca-11da-be43-001422106990)] 1.28 +interface nsISAXErrorHandler: nsISupports { 1.29 + 1.30 + /** 1.31 + * Receive notification of a recoverable error. 1.32 + * 1.33 + * This corresponds to the definition of "error" in section 1.2 1.34 + * of the W3C XML 1.0 Recommendation. For example, a validating 1.35 + * parser would use this callback to report the violation of a 1.36 + * validity constraint. The default behaviour is to take no 1.37 + * action. 1.38 + * 1.39 + * The SAX parser must continue to provide normal parsing events 1.40 + * after invoking this method: it should still be possible for the 1.41 + * application to process the document through to the end. If the 1.42 + * application cannot do so, then the parser should report a fatal 1.43 + * error even if the XML recommendation does not require it to do 1.44 + * so. 1.45 + * 1.46 + * Filters may use this method to report other, non-XML errors as 1.47 + * well. 1.48 + * 1.49 + * @param locator The locator object for the error (may be null). 1.50 + * @param error The error message. 1.51 + */ 1.52 + void error(in nsISAXLocator locator, in AString error); 1.53 + 1.54 + /** 1.55 + * Receive notification of a non-recoverable error. 1.56 + * 1.57 + * There is an apparent contradiction between the documentation 1.58 + * for this method and the documentation for 1.59 + * ContentHandler.endDocument(). Until this ambiguity is resolved in 1.60 + * a future major release, clients should make no assumptions about 1.61 + * whether endDocument() will or will not be invoked when the parser 1.62 + * has reported a fatalError() or thrown an exception. 1.63 + * 1.64 + * This corresponds to the definition of "fatal error" in section 1.65 + * 1.2 of the W3C XML 1.0 Recommendation. For example, a parser 1.66 + * would use this callback to report the violation of a 1.67 + * well-formedness constraint. 1.68 + * 1.69 + * The application must assume that the document is unusable 1.70 + * after the parser has invoked this method, and should continue (if 1.71 + * at all) only for the sake of collecting additional error 1.72 + * messages: in fact, SAX parsers are free to stop reporting any 1.73 + * other events once this method has been invoked. 1.74 + * 1.75 + * @param locator The locator object for the error (may be null). 1.76 + * @param error The error message. 1.77 + */ 1.78 + void fatalError(in nsISAXLocator locator, in AString error); 1.79 + 1.80 + /** 1.81 + * Receive notification of a warning. 1.82 + * 1.83 + * SAX parsers will use this method to report conditions that are 1.84 + * not errors or fatal errors as defined by the XML 1.85 + * recommendation. The default behaviour is to take no action. 1.86 + * 1.87 + * The SAX parser must continue to provide normal parsing events 1.88 + * after invoking this method: it should still be possible for the 1.89 + * application to process the document through to the end. 1.90 + * 1.91 + * Filters may use this method to report other, non-XML warnings 1.92 + * as well. 1.93 + * 1.94 + * @param locator The locator object for the warning (may be null). 1.95 + * @param error The warning message. 1.96 + */ 1.97 + void ignorableWarning(in nsISAXLocator locator, in AString error); 1.98 +};