01: package com.jclark.xml.tok;
02:
03: /**
04: * Thrown to indicate that the byte subarray being tokenized does not start
05: * with a legal XML token and cannot start one if more bytes are added.
06: * @version $Revision: 1.3 $ $Date: 1998/02/17 04:24:08 $
07: */
08: public class InvalidTokenException extends TokenException {
09: private/* final */int offset;
10:
11: /**
12: * The character or byte at the specified offset is not allowed
13: * at that point.
14: */
15: public static final byte ILLEGAL_CHAR = 0;
16: /**
17: * The target of a processing instruction was XML.
18: */
19: public static final byte XML_TARGET = 1;
20: /**
21: * A duplicate attribute was specified.
22: */
23: public static final byte DUPLICATE_ATTRIBUTE = 2;
24:
25: private/* final */byte type;
26:
27: InvalidTokenException(int offset, byte type) {
28: this .offset = offset;
29: this .type = type;
30: }
31:
32: InvalidTokenException(int offset) {
33: this .offset = offset;
34: this .type = ILLEGAL_CHAR;
35: }
36:
37: /**
38: * Returns the offset after the longest initial subarray
39: * which could start a legal XML token.
40: */
41: public final int getOffset() {
42: return offset;
43: }
44:
45: public final byte getType() {
46: return type;
47: }
48: }
|