001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.xerces.impl.dtd;
019:
020: import org.apache.xerces.impl.dv.DatatypeValidator;
021:
022: /**
023: * @xerces.internal
024: *
025: * @version $Id: XMLSimpleType.java 446755 2006-09-15 21:56:27Z mrglavas $
026: */
027: public class XMLSimpleType {
028:
029: //
030: // Constants
031: //
032:
033: /** TYPE_CDATA */
034: public static final short TYPE_CDATA = 0;
035:
036: /** TYPE_ENTITY */
037: public static final short TYPE_ENTITY = 1;
038:
039: /** TYPE_ENUMERATION */
040: public static final short TYPE_ENUMERATION = 2;
041:
042: /** TYPE_ID */
043: public static final short TYPE_ID = 3;
044:
045: /** TYPE_IDREF */
046: public static final short TYPE_IDREF = 4;
047:
048: /** TYPE_NMTOKEN */
049: public static final short TYPE_NMTOKEN = 5;
050:
051: /** TYPE_NOTATION */
052: public static final short TYPE_NOTATION = 6;
053:
054: /** TYPE_NAMED */
055: public static final short TYPE_NAMED = 7;
056:
057: /** DEFAULT_TYPE_DEFAULT */
058: public static final short DEFAULT_TYPE_DEFAULT = 3;
059:
060: /** DEFAULT_TYPE_FIXED */
061: public static final short DEFAULT_TYPE_FIXED = 1;
062:
063: /** DEFAULT_TYPE_IMPLIED */
064: public static final short DEFAULT_TYPE_IMPLIED = 0;
065:
066: /** DEFAULT_TYPE_REQUIRED */
067: public static final short DEFAULT_TYPE_REQUIRED = 2;
068:
069: //
070: // Data
071: //
072:
073: /** type */
074: public short type;
075:
076: /** name */
077: public String name;
078:
079: /** enumeration */
080: public String[] enumeration;
081:
082: /** list */
083: public boolean list;
084:
085: /** defaultType */
086: public short defaultType;
087:
088: /** defaultValue */
089: public String defaultValue;
090:
091: /** non-normalized defaultValue */
092: public String nonNormalizedDefaultValue;
093:
094: /** datatypeValidator */
095: public DatatypeValidator datatypeValidator;
096:
097: //
098: // Methods
099: //
100:
101: /**
102: * setValues
103: *
104: * @param type
105: * @param name
106: * @param enumeration
107: * @param list
108: * @param defaultType
109: * @param defaultValue
110: * @param nonNormalizedDefaultValue
111: * @param datatypeValidator
112: */
113: public void setValues(short type, String name,
114: String[] enumeration, boolean list, short defaultType,
115: String defaultValue, String nonNormalizedDefaultValue,
116: DatatypeValidator datatypeValidator) {
117:
118: this .type = type;
119: this .name = name;
120: // REVISIT: Should this be a copy? -Ac
121: if (enumeration != null && enumeration.length > 0) {
122: this .enumeration = new String[enumeration.length];
123: System.arraycopy(enumeration, 0, this .enumeration, 0,
124: this .enumeration.length);
125: } else {
126: this .enumeration = null;
127: }
128: this .list = list;
129: this .defaultType = defaultType;
130: this .defaultValue = defaultValue;
131: this .nonNormalizedDefaultValue = nonNormalizedDefaultValue;
132: this .datatypeValidator = datatypeValidator;
133:
134: } // setValues(short,String,String[],boolean,short,String,String,DatatypeValidator)
135:
136: /** Set values. */
137: public void setValues(XMLSimpleType simpleType) {
138:
139: type = simpleType.type;
140: name = simpleType.name;
141: // REVISIT: Should this be a copy? -Ac
142: if (simpleType.enumeration != null
143: && simpleType.enumeration.length > 0) {
144: enumeration = new String[simpleType.enumeration.length];
145: System.arraycopy(simpleType.enumeration, 0, enumeration, 0,
146: enumeration.length);
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
|