1 16 17 package org.apache.xerces.impl.dtd; 18 19 import org.apache.xerces.impl.dv.DatatypeValidator; 20 21 26 public class XMLSimpleType { 27 28 32 33 public static final short TYPE_CDATA = 0; 34 35 36 public static final short TYPE_ENTITY = 1; 37 38 39 public static final short TYPE_ENUMERATION = 2; 40 41 42 public static final short TYPE_ID = 3; 43 44 45 public static final short TYPE_IDREF = 4; 46 47 48 public static final short TYPE_NMTOKEN = 5; 49 50 51 public static final short TYPE_NOTATION = 6; 52 53 54 public static final short TYPE_NAMED = 7; 55 56 57 public static final short DEFAULT_TYPE_DEFAULT = 3; 58 59 60 public static final short DEFAULT_TYPE_FIXED = 1; 61 62 63 public static final short DEFAULT_TYPE_IMPLIED = 0; 64 65 66 public static final short DEFAULT_TYPE_REQUIRED = 2; 67 68 72 73 public short type; 74 75 76 public String name; 77 78 79 public String [] enumeration; 80 81 82 public boolean list; 83 84 85 public short defaultType; 86 87 88 public String defaultValue; 89 90 91 public String nonNormalizedDefaultValue; 92 93 94 public DatatypeValidator datatypeValidator; 95 96 100 112 public void setValues(short type, String name, String [] enumeration, 113 boolean list, short defaultType, 114 String defaultValue, String nonNormalizedDefaultValue, 115 DatatypeValidator datatypeValidator) { 116 117 this.type = type; 118 this.name = name; 119 if (enumeration != null && enumeration.length > 0) { 121 this.enumeration = new String [enumeration.length]; 122 System.arraycopy(enumeration, 0, this.enumeration, 0, this.enumeration.length); 123 } 124 else { 125 this.enumeration = null; 126 } 127 this.list = list; 128 this.defaultType = defaultType; 129 this.defaultValue = defaultValue; 130 this.nonNormalizedDefaultValue = nonNormalizedDefaultValue; 131 this.datatypeValidator = datatypeValidator; 132 133 } 135 136 public void setValues(XMLSimpleType simpleType) { 137 138 type = simpleType.type; 139 name = simpleType.name; 140 if (simpleType.enumeration != null && simpleType.enumeration.length > 0) { 142 enumeration = new String [simpleType.enumeration.length]; 143 System.arraycopy(simpleType.enumeration, 0, enumeration, 0, enumeration.length); 144 } 145 else { 146 enumeration = null; 147 } 148 list = simpleType.list; 149 defaultType = simpleType.defaultType; 150 defaultValue = simpleType.defaultValue; 151 nonNormalizedDefaultValue = simpleType.nonNormalizedDefaultValue; 152 datatypeValidator = simpleType.datatypeValidator; 153 154 } 156 159 public void clear() { 160 this.type = -1; 161 this.name = null; 162 this.enumeration = null; 163 this.list = false; 164 this.defaultType = -1; 165 this.defaultValue = null; 166 this.nonNormalizedDefaultValue = null; 167 this.datatypeValidator = null; 168 } 170 } | Popular Tags |