KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > dtd > XMLSimpleType


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.impl.dtd;
18
19 import org.apache.xerces.impl.dv.DatatypeValidator;
20
21 /**
22  * @xerces.internal
23  *
24  * @version $Id: XMLSimpleType.java,v 1.7 2004/10/04 21:57:30 mrglavas Exp $
25  */

26 public class XMLSimpleType {
27
28     //
29
// Constants
30
//
31

32     /** TYPE_CDATA */
33     public static final short TYPE_CDATA = 0;
34
35     /** TYPE_ENTITY */
36     public static final short TYPE_ENTITY = 1;
37
38     /** TYPE_ENUMERATION */
39     public static final short TYPE_ENUMERATION = 2;
40
41     /** TYPE_ID */
42     public static final short TYPE_ID = 3;
43
44     /** TYPE_IDREF */
45     public static final short TYPE_IDREF = 4;
46
47     /** TYPE_NMTOKEN */
48     public static final short TYPE_NMTOKEN = 5;
49
50     /** TYPE_NOTATION */
51     public static final short TYPE_NOTATION = 6;
52
53     /** TYPE_NAMED */
54     public static final short TYPE_NAMED = 7;
55
56     /** DEFAULT_TYPE_DEFAULT */
57     public static final short DEFAULT_TYPE_DEFAULT = 3;
58
59     /** DEFAULT_TYPE_FIXED */
60     public static final short DEFAULT_TYPE_FIXED = 1;
61
62     /** DEFAULT_TYPE_IMPLIED */
63     public static final short DEFAULT_TYPE_IMPLIED = 0;
64
65     /** DEFAULT_TYPE_REQUIRED */
66     public static final short DEFAULT_TYPE_REQUIRED = 2;
67
68     //
69
// Data
70
//
71

72     /** type */
73     public short type;
74
75     /** name */
76     public String JavaDoc name;
77
78     /** enumeration */
79     public String JavaDoc[] enumeration;
80
81     /** list */
82     public boolean list;
83
84     /** defaultType */
85     public short defaultType;
86
87     /** defaultValue */
88     public String JavaDoc defaultValue;
89
90     /** non-normalized defaultValue */
91     public String JavaDoc nonNormalizedDefaultValue;
92
93     /** datatypeValidator */
94     public DatatypeValidator datatypeValidator;
95
96     //
97
// Methods
98
//
99

100     /**
101      * setValues
102      *
103      * @param type
104      * @param name
105      * @param enumeration
106      * @param list
107      * @param defaultType
108      * @param defaultValue
109      * @param nonNormalizedDefaultValue
110      * @param datatypeValidator
111      */

112     public void setValues(short type, String JavaDoc name, String JavaDoc[] enumeration,
113                           boolean list, short defaultType,
114                           String JavaDoc defaultValue, String JavaDoc nonNormalizedDefaultValue,
115                           DatatypeValidator datatypeValidator) {
116
117         this.type = type;
118         this.name = name;
119         // REVISIT: Should this be a copy? -Ac
120
if (enumeration != null && enumeration.length > 0) {
121             this.enumeration = new String JavaDoc[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     } // setValues(short,String,String[],boolean,short,String,String,DatatypeValidator)
134

135     /** Set values. */
136     public void setValues(XMLSimpleType simpleType) {
137
138         type = simpleType.type;
139         name = simpleType.name;
140         // REVISIT: Should this be a copy? -Ac
141
if (simpleType.enumeration != null && simpleType.enumeration.length > 0) {
142             enumeration = new String JavaDoc[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     } // setValues(XMLSimpleType)
155

156     /**
157      * clear
158      */

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     } // clear
169

170 } // class XMLSimpleType
171
Popular Tags