01: package com.jclark.xml.parse;
02:
03: import java.net.URL;
04:
05: /**
06: * Thrown when an XML document is not well-formed.
07: * @version $Revision: 1.5 $ $Date: 1998/05/25 03:39:22 $
08: */
09: public class NotWellFormedException extends java.io.IOException
10: implements ParseLocation {
11: private String messageWithoutLocation;
12: private String entityLocation;
13: private URL entityBase;
14: private int lineNumber;
15: private int columnNumber;
16: private long byteIndex;
17:
18: NotWellFormedException(String message,
19: String messageWithoutLocation, String entityLocation,
20: URL entityBase, int lineNumber, int columnNumber,
21: long byteIndex) {
22: super (message);
23: this .messageWithoutLocation = messageWithoutLocation;
24: this .entityLocation = entityLocation;
25: this .entityBase = entityBase;
26: this .lineNumber = lineNumber;
27: this .columnNumber = columnNumber;
28: this .byteIndex = byteIndex;
29: }
30:
31: /**
32: * Returns the location of the external entity where the
33: * the error occurred in a form suitable for use in an error message.
34: * This is typically a URI or a filename.
35: */
36: public final String getEntityLocation() {
37: return entityLocation;
38: }
39:
40: /**
41: * Returns the URL used as the base URL for resolving relative URLs
42: * contained in the entity where the error occurred.
43: */
44: public final URL getEntityBase() {
45: return entityBase;
46: }
47:
48: /**
49: * Returns the line number where the error occured.
50: * The first line has number 1.
51: */
52: public final int getLineNumber() {
53: return lineNumber;
54: }
55:
56: /**
57: * Returns the column number where the error occurred.
58: * The first column has number 0.
59: */
60: public final int getColumnNumber() {
61: return columnNumber;
62: }
63:
64: /**
65: * Returns the index of the byte in the entity where the error occurred.
66: * The first byte has offset 0.
67: */
68: public final long getByteIndex() {
69: return byteIndex;
70: }
71:
72: /**
73: * Returns a description of the error that does not include
74: * the location of the error.
75: * <code>getMessage</code> returns a description of the error
76: * that does include the location.
77: */
78: public final String getMessageWithoutLocation() {
79: return messageWithoutLocation;
80: }
81: }
|