File: InvalidTokenException.java

package info (click to toggle)
lib-xp-java 0.5-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,652 kB
  • ctags: 2,424
  • sloc: java: 8,085; makefile: 53; sh: 17; xml: 7
file content (47 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.jclark.xml.tok;

/**
 * Thrown to indicate that the byte subarray being tokenized does not start
 * with a legal XML token and cannot start one if more bytes are added.
 * @version $Revision: 1.3 $ $Date: 1998/02/17 04:24:08 $
 */
public class InvalidTokenException extends TokenException {
  private /* final */ int offset;

  /**
   * The character or byte at the specified offset is not allowed
   * at that point.
   */
  public static final byte ILLEGAL_CHAR = 0;
  /**
   * The target of a processing instruction was XML.
   */
  public static final byte XML_TARGET = 1;
  /**
   * A duplicate attribute was specified.
   */
  public static final byte DUPLICATE_ATTRIBUTE = 2;

  private /* final */ byte type;
  
  InvalidTokenException(int offset, byte type) {
    this.offset = offset;
    this.type = type;
  }

  InvalidTokenException(int offset) {
    this.offset = offset;
    this.type = ILLEGAL_CHAR;
  }

  /**
   * Returns the offset after the longest initial subarray
   * which could start a legal XML token.
   */
  public final int getOffset() {
    return offset;
  }
  public final byte getType() {
    return type;
  }
}