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