1 package net.sf.saxon.om; 2 3 4 8 9 public final class Validation { 10 11 public static final int INVALID = -1; 12 13 public static final int STRICT = 1; 14 public static final int LAX = 2; 15 public static final int PRESERVE = 3; 16 public static final int STRIP = 4; 17 public static final int SKIP = 4; 19 public static final int DEFAULT = 0; 20 21 public static final int VALIDATION_MODE_MASK = 0xff; 22 23 public static final int VALIDATE_OUTPUT = 0x10000; 24 25 28 29 private Validation() { 30 } 31 32 public static int getCode(String value) { 33 if (value.equals("strict")) { 34 return STRICT; 35 } else if (value.equals("lax")) { 36 return LAX; 37 } else if (value.equals("preserve")) { 38 return PRESERVE; 39 } else if (value.equals("strip")) { 40 return STRIP; 41 } else { 42 return INVALID; 43 } 44 } 45 46 public static String toString(int value) { 47 switch(value & VALIDATION_MODE_MASK) { 48 case STRICT: return "strict"; 49 case LAX: return "lax"; 50 case PRESERVE: return "preserve"; 51 case STRIP: return "skip"; default: return "invalid"; 53 } 54 } 55 } 56 57 | Popular Tags |