1 package eu.simuline.util.sgml;
2
3 /**
4 * Rudimentary Handler for SAXParseExceptions:
5 * The idea is that for html-parsers one needs a notify
6 * rather than throwing an exception as it is appropriate for xml.
7 *
8 * @author <a href="mailto:ernst.reissner@simuline.eu">Ernst Reissner</a>
9 * @version 1.0
10 */
11 public interface ParseExceptionHandler {
12
13 /* --------------------------------------------------------------------- *
14 * inner classes *
15 * --------------------------------------------------------------------- */
16
17 /**
18 * Trivial implementation for enclosing interface.
19 */
20 class Impl implements ParseExceptionHandler {
21
22 public void foundMultipleAttribute(String attrName,
23 Object oldAttrValue) {
24 // is empty.
25 }
26
27 public void foundIllegalCharInTag(char chr) {
28 // is empty.
29 }
30
31 public void foundCharAfterEndOfEndTag(char chr) {
32 // is empty.
33 }
34
35 public void foundUnexpectedEndOfDocument() {
36 // is empty.
37 }
38 } // class Impl
39
40 /* --------------------------------------------------------------------- *
41 * methods *
42 * --------------------------------------------------------------------- */
43
44 /**
45 * Notifies the occurence of a duplicate attribute declaration
46 * within a start tag.
47 *
48 * @param attrName
49 * a non-empty <code>String</code>
50 * representing the name of the attribute.
51 * @param oldAttrValue
52 * an <code>Object</code> which is either a <code>String</code>
53 * representing the value of the attribute
54 * or the object {@link AttributesImpl#NO_VALUE}
55 * which signifies the absence of a value.
56 * Here the old value (which is overwritten in the attribute list)
57 * should be passed to the application.
58 * ****** it is not clear to me
59 * whether the ordering of the attribute list is significant.
60 * The former occurence of the attribute is lost. **** is this true?
61 */
62 void foundMultipleAttribute(String attrName, Object oldAttrValue);
63
64 /**
65 * Notifies that an illegal character was found in a tag *****.
66 * To be more precise: at the beginning of the tag.
67 * Note that this is ignored and the next one is read.
68 *
69 * @param chr
70 * the illegal <code>char</code> value.
71 */
72 void foundIllegalCharInTag(char chr);
73
74 /**
75 * Notifies that a character was found after the "/" of an end tag.
76 * Note that this is ignored and the next one is read.
77 *
78 * @param chr
79 * the illegal <code>char</code> value.
80 */
81 void foundCharAfterEndOfEndTag(char chr);
82
83 // ****** would need an argument
84 void foundUnexpectedEndOfDocument();
85 } // ParseExceptionHandler