1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 package com.sun.org.apache.xerces.internal.impl.dtd; 23 24 import com.sun.org.apache.xerces.internal.impl.dv.DatatypeValidator; 25 26 /** 27 */ 28 public class XMLSimpleType { 29 30 // 31 // Constants 32 // 33 34 /** TYPE_CDATA */ 35 public static final short TYPE_CDATA = 0; 36 37 /** TYPE_ENTITY */ 38 public static final short TYPE_ENTITY = 1; 39 40 /** TYPE_ENUMERATION */ 41 public static final short TYPE_ENUMERATION = 2; 42 43 /** TYPE_ID */ 44 public static final short TYPE_ID = 3; 45 46 /** TYPE_IDREF */ 47 public static final short TYPE_IDREF = 4; 48 49 /** TYPE_NMTOKEN */ 50 public static final short TYPE_NMTOKEN = 5; 51 52 /** TYPE_NOTATION */ 53 public static final short TYPE_NOTATION = 6; 54 55 /** TYPE_NAMED */ 56 public static final short TYPE_NAMED = 7; 57 58 /** DEFAULT_TYPE_DEFAULT */ 59 public static final short DEFAULT_TYPE_DEFAULT = 3; 60 61 /** DEFAULT_TYPE_FIXED */ 62 public static final short DEFAULT_TYPE_FIXED = 1; 63 64 /** DEFAULT_TYPE_IMPLIED */ 65 public static final short DEFAULT_TYPE_IMPLIED = 0; 66 67 /** DEFAULT_TYPE_REQUIRED */ 68 public static final short DEFAULT_TYPE_REQUIRED = 2; 69 70 // 71 // Data 72 // 73 74 /** type */ 75 public short type; 76 77 /** name */ 78 public String name; 79 80 /** enumeration */ 81 public String[] enumeration; 82 83 /** list */ 84 public boolean list; 85 86 /** defaultType */ 87 public short defaultType; 88 89 /** defaultValue */ 90 public String defaultValue; 91 92 /** non-normalized defaultValue */ 93 public String nonNormalizedDefaultValue; 94 95 /** datatypeValidator */ 96 public DatatypeValidator datatypeValidator; 97 98 // 99 // Methods 100 // 101 102 /** 103 * setValues 104 * 105 * @param type 106 * @param name 107 * @param enumeration 108 * @param list 109 * @param defaultType 110 * @param defaultValue 111 * @param nonNormalizedDefaultValue 112 * @param datatypeValidator 113 */ 114 public void setValues(short type, String name, String[] enumeration, 115 boolean list, short defaultType, 116 String defaultValue, String nonNormalizedDefaultValue, 117 DatatypeValidator datatypeValidator) { 118 119 this.type = type; 120 this.name = name; 121 // REVISIT: Should this be a copy? -Ac 122 if (enumeration != null && enumeration.length > 0) { 123 this.enumeration = new String[enumeration.length]; 124 System.arraycopy(enumeration, 0, this.enumeration, 0, this.enumeration.length); 125 } 126 else { 127 this.enumeration = null; 128 } 129 this.list = list; 130 this.defaultType = defaultType; 131 this.defaultValue = defaultValue; 132 this.nonNormalizedDefaultValue = nonNormalizedDefaultValue; 133 this.datatypeValidator = datatypeValidator; 134 135 } // setValues(short,String,String[],boolean,short,String,String,DatatypeValidator) 136 137 /** Set values. */ 138 public void setValues(XMLSimpleType simpleType) { 139 140 type = simpleType.type; 141 name = simpleType.name; 142 // REVISIT: Should this be a copy? -Ac 143 if (simpleType.enumeration != null && simpleType.enumeration.length > 0) { 144 enumeration = new String[simpleType.enumeration.length]; 145 System.arraycopy(simpleType.enumeration, 0, enumeration, 0, enumeration.length); 146 } 147 else { 148 enumeration = null; 149 } 150 list = simpleType.list; 151 defaultType = simpleType.defaultType; 152 defaultValue = simpleType.defaultValue; 153 nonNormalizedDefaultValue = simpleType.nonNormalizedDefaultValue; 154 datatypeValidator = simpleType.datatypeValidator; 155 156 } // setValues(XMLSimpleType) 157 158 /** 159 * clear 160 */ 161 public void clear() { 162 this.type = -1; 163 this.name = null; 164 this.enumeration = null; 165 this.list = false; 166 this.defaultType = -1; 167 this.defaultValue = null; 168 this.nonNormalizedDefaultValue = null; 169 this.datatypeValidator = null; 170 } // clear 171 172 } // class XMLSimpleType