1 57 58 package com.sun.org.apache.xerces.internal.impl.dtd; 59 import com.sun.org.apache.xerces.internal.impl.dv.DatatypeValidator; 60 63 public class XMLSimpleType { 64 65 69 70 public static final short TYPE_CDATA = 0; 71 72 73 public static final short TYPE_ENTITY = 1; 74 75 76 public static final short TYPE_ENUMERATION = 2; 77 78 79 public static final short TYPE_ID = 3; 80 81 82 public static final short TYPE_IDREF = 4; 83 84 85 public static final short TYPE_NMTOKEN = 5; 86 87 88 public static final short TYPE_NOTATION = 6; 89 90 91 public static final short TYPE_NAMED = 7; 92 93 94 public static final short DEFAULT_TYPE_DEFAULT = 3; 95 96 97 public static final short DEFAULT_TYPE_FIXED = 1; 98 99 100 public static final short DEFAULT_TYPE_IMPLIED = 0; 101 102 103 public static final short DEFAULT_TYPE_REQUIRED = 2; 104 105 109 110 public short type; 111 112 113 public String name; 114 115 116 public String [] enumeration; 117 118 119 public boolean list; 120 121 122 public short defaultType; 123 124 125 public String defaultValue; 126 127 128 public String nonNormalizedDefaultValue; 129 130 131 public DatatypeValidator datatypeValidator; 132 133 137 149 public void setValues(short type, String name, String [] enumeration, 150 boolean list, short defaultType, 151 String defaultValue, String nonNormalizedDefaultValue, 152 DatatypeValidator datatypeValidator) { 153 154 this.type = type; 155 this.name = name; 156 if (enumeration != null && enumeration.length > 0) { 158 this.enumeration = new String [enumeration.length]; 159 System.arraycopy(enumeration, 0, this.enumeration, 0, this.enumeration.length); 160 } 161 else { 162 this.enumeration = null; 163 } 164 this.list = list; 165 this.defaultType = defaultType; 166 this.defaultValue = defaultValue; 167 this.nonNormalizedDefaultValue = nonNormalizedDefaultValue; 168 this.datatypeValidator = datatypeValidator; 169 170 } 172 173 public void setValues(XMLSimpleType simpleType) { 174 175 type = simpleType.type; 176 name = simpleType.name; 177 if (simpleType.enumeration != null && simpleType.enumeration.length > 0) { 179 enumeration = new String [simpleType.enumeration.length]; 180 System.arraycopy(simpleType.enumeration, 0, enumeration, 0, enumeration.length); 181 } 182 else { 183 enumeration = null; 184 } 185 list = simpleType.list; 186 defaultType = simpleType.defaultType; 187 defaultValue = simpleType.defaultValue; 188 nonNormalizedDefaultValue = simpleType.nonNormalizedDefaultValue; 189 datatypeValidator = simpleType.datatypeValidator; 190 191 } 193 196 public void clear() { 197 this.type = -1; 198 this.name = null; 199 this.enumeration = null; 200 this.list = false; 201 this.defaultType = -1; 202 this.defaultValue = null; 203 this.nonNormalizedDefaultValue = null; 204 this.datatypeValidator = null; 205 } 207 } | Popular Tags |