1 /*
2 * Copyright (c) 2004 World Wide Web Consortium,
3 *
4 * (Massachusetts Institute of Technology, European Research Consortium for
5 * Informatics and Mathematics, Keio University). All Rights Reserved. This
6 * work is distributed under the W3C(r) Software License [1] in the hope that
7 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11 */
12
13 package org.w3c.dom;
14
15 /**
16 * <code>DOMError</code> is an interface that describes an error.
17 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
18 * @since DOM Level 3
19 */
20 public interface DOMError {
21 // ErrorSeverity
22 /**
23 * The severity of the error described by the <code>DOMError</code> is
24 * warning. A <code>SEVERITY_WARNING</code> will not cause the
25 * processing to stop, unless <code>DOMErrorHandler.handleError()</code>
26 * returns <code>false</code>.
27 */
28 public static final short SEVERITY_WARNING = 1;
29 /**
30 * The severity of the error described by the <code>DOMError</code> is
31 * error. A <code>SEVERITY_ERROR</code> may not cause the processing to
32 * stop if the error can be recovered, unless
33 * <code>DOMErrorHandler.handleError()</code> returns <code>false</code>.
34 */
35 public static final short SEVERITY_ERROR = 2;
36 /**
37 * The severity of the error described by the <code>DOMError</code> is
38 * fatal error. A <code>SEVERITY_FATAL_ERROR</code> will cause the
39 * normal processing to stop. The return value of
40 * <code>DOMErrorHandler.handleError()</code> is ignored unless the
41 * implementation chooses to continue, in which case the behavior
42 * becomes undefined.
43 */
44 public static final short SEVERITY_FATAL_ERROR = 3;
45
46 /**
47 * The severity of the error, either <code>SEVERITY_WARNING</code>,
48 * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.
49 */
50 public short getSeverity();
51
52 /**
53 * An implementation specific string describing the error that occurred.
54 */
55 public String getMessage();
56
57 /**
58 * A <code>DOMString</code> indicating which related data is expected in
59 * <code>relatedData</code>. Users should refer to the specification of
60 * the error in order to find its <code>DOMString</code> type and
61 * <code>relatedData</code> definitions if any.
62 * <p ><b>Note:</b> As an example,
63 * <code>Document.normalizeDocument()</code> does generate warnings when
64 * the "split-cdata-sections" parameter is in use. Therefore, the method
65 * generates a <code>SEVERITY_WARNING</code> with <code>type</code>
66 * <code>"cdata-sections-splitted"</code> and the first
67 * <code>CDATASection</code> node in document order resulting from the
68 * split is returned by the <code>relatedData</code> attribute.
69 */
70 public String getType();
71
72 /**
73 * The related platform dependent exception if any.
74 */
75 public Object getRelatedException();
76
77 /**
78 * The related <code>DOMError.type</code> dependent data if any.
79 */
80 public Object getRelatedData();
81
82 /**
83 * The location of the error.
84 */
85 public DOMLocator getLocation();
86
87 }