~ubuntu-branches/debian/wheezy/jing-trang/wheezy

« back to all changes in this revision

Viewing changes to mod/dtd-parse/src/main/com/thaiopensource/xml/tok/InvalidTokenException.java

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Thibault
  • Date: 2009-09-01 15:53:03 UTC
  • Revision ID: james.westby@ubuntu.com-20090901155303-2kweef05h5v9j3ni
Tags: upstream-20090818
ImportĀ upstreamĀ versionĀ 20090818

Show diffs side-by-side

added added

removed removed

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