KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > apache > xerces > validators > schema > GeneralAttrCheck


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2000,2001 The Apache Software Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Xerces" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 1999, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package org.enhydra.apache.xerces.validators.schema;
59
60 import java.util.Enumeration JavaDoc;
61 import java.util.Hashtable JavaDoc;
62 import java.util.StringTokenizer JavaDoc;
63 import java.util.Vector JavaDoc;
64
65 import org.enhydra.apache.xerces.framework.XMLErrorReporter;
66 import org.enhydra.apache.xerces.validators.common.Grammar;
67 import org.enhydra.apache.xerces.validators.common.GrammarResolver;
68 import org.enhydra.apache.xerces.validators.common.XMLAttributeDecl;
69 import org.enhydra.apache.xerces.validators.datatype.DatatypeValidator;
70 import org.enhydra.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl;
71 import org.enhydra.apache.xerces.validators.datatype.IDDatatypeValidator;
72 import org.enhydra.apache.xerces.validators.datatype.InvalidDatatypeValueException;
73 import org.w3c.dom.Attr JavaDoc;
74 import org.w3c.dom.Element JavaDoc;
75 import org.w3c.dom.NamedNodeMap JavaDoc;
76
77 /**
78  * Title:
79  * Description:
80  * Copyright: Copyright (c) 2001
81  * @author: Sandy Gao, IBM
82  * @version 1.0
83  */

84
85 public class GeneralAttrCheck {
86
87     // used to specify in which context the element appears: global or local
88
public static int ELE_CONTEXT_GLOBAL = 0;
89     public static int ELE_CONTEXT_LOCAL = 1;
90
91     // used to specify whether the attribute is optional,
92
// and whether it has a default value
93
public static int ATT_REQUIRED = 0;
94     public static int ATT_OPT_DFLT = 1;
95     public static int ATT_OPT_NODFLT = 2;
96
97     // the prefix to distinguish gloval vs. local; name vs. ref
98
protected static String JavaDoc PRE_GLOBAL = "G_";
99     protected static String JavaDoc PRE_LOC_NAME = "LN_";
100     protected static String JavaDoc PRE_LOC_REF = "LR_";
101
102     // used to store the map from element name to attribute list
103
protected static Hashtable JavaDoc fEleAttrsMap = new Hashtable JavaDoc();
104
105     // used to store extra datatype validators
106
protected static DatatypeValidator[] fExtraDVs = null;
107
108     // used to initialize fEleAttrsMap
109
// step 1: all possible data types
110
// DT_??? >= 0 : validate using a validator, which is initialized staticly
111
// DT_??? < 0 : validate directly, which is done in "validate()"
112
protected static int dtCount = 0;
113
114     protected static final int DT_ANYURI = dtCount++;
115     protected static final int DT_BOOLEAN = dtCount++;
116     protected static final int DT_ID = dtCount++;
117     protected static final int DT_NONNEGINT = dtCount++;
118     protected static final int DT_QNAME = dtCount++;
119     protected static final int DT_STRING = dtCount++;
120     protected static final int DT_TOKEN = dtCount++;
121     protected static final int DT_NCNAME = dtCount++;
122     protected static final int DT_XPATH = dtCount++;
123     protected static final int DT_XPATH1 = dtCount++;
124
125     protected static final int DT_BLOCK = -1;
126     protected static final int DT_BLOCK1 = DT_BLOCK-1;
127     protected static final int DT_FINAL = DT_BLOCK1-1;
128     protected static final int DT_FINAL1 = DT_FINAL-1;
129     protected static final int DT_FORM = DT_FINAL1-1;
130     protected static final int DT_MAXOCCURS = DT_FORM-1;
131     protected static final int DT_MAXOCCURS1 = DT_MAXOCCURS-1;
132     protected static final int DT_MEMBERTYPES = DT_MAXOCCURS1-1;
133     protected static final int DT_MINOCCURS1 = DT_MEMBERTYPES-1;
134     protected static final int DT_NAMESPACE = DT_MINOCCURS1-1;
135     protected static final int DT_PROCESSCONTENTS = DT_NAMESPACE-1;
136     protected static final int DT_PUBLIC = DT_PROCESSCONTENTS-1;
137     protected static final int DT_USE = DT_PUBLIC-1;
138     protected static final int DT_WHITESPACE = DT_USE-1;
139
140     static {
141         fExtraDVs = new DatatypeValidator[dtCount];
142
143         // step 2: all possible attributes for all elements
144
int attCount = 0;
145         int ATT_ABSTRACT_D = attCount++;
146         int ATT_ATTRIBUTE_FD_D = attCount++;
147         int ATT_BASE_R = attCount++;
148         int ATT_BASE_N = attCount++;
149         int ATT_BLOCK_N = attCount++;
150         int ATT_BLOCK1_N = attCount++;
151         int ATT_BLOCK_D_D = attCount++;
152         int ATT_DEFAULT_N = attCount++;
153         int ATT_ELEMENT_FD_D = attCount++;
154         int ATT_FINAL_N = attCount++;
155         int ATT_FINAL1_N = attCount++;
156         int ATT_FINAL_D_D = attCount++;
157         int ATT_FIXED_N = attCount++;
158         int ATT_FIXED_D = attCount++;
159         int ATT_FORM_N = attCount++;
160         int ATT_ID_N = attCount++;
161         int ATT_ITEMTYPE_N = attCount++;
162         int ATT_MAXOCCURS_D = attCount++;
163         int ATT_MAXOCCURS1_D = attCount++;
164         int ATT_MEMBER_T_N = attCount++;
165         int ATT_MINOCCURS_D = attCount++;
166         int ATT_MINOCCURS1_D = attCount++;
167         int ATT_MIXED_D = attCount++;
168         int ATT_MIXED_N = attCount++;
169         int ATT_NAME_R = attCount++;
170         int ATT_NAMESPACE_D = attCount++;
171         int ATT_NAMESPACE_N = attCount++;
172         int ATT_NILLABLE_D = attCount++;
173         int ATT_PROCESS_C_D = attCount++;
174         int ATT_PUBLIC_R = attCount++;
175         int ATT_REF_R = attCount++;
176         int ATT_REFER_R = attCount++;
177         int ATT_SCHEMA_L_R = attCount++;
178         int ATT_SCHEMA_L_N = attCount++;
179         int ATT_SOURCE_N = attCount++;
180         int ATT_SUBSTITUTION_G_N = attCount++;
181         int ATT_SYSTEM_N = attCount++;
182         int ATT_TARGET_N_N = attCount++;
183         int ATT_TYPE_N = attCount++;
184         int ATT_USE_D = attCount++;
185         int ATT_VALUE_NNI_N = attCount++;
186         int ATT_VALUE_STR_N = attCount++;
187         int ATT_VALUE_WS_N = attCount++;
188         int ATT_VERSION_N = attCount++;
189         int ATT_XPATH_R = attCount++;
190         int ATT_XPATH1_R = attCount++;
191
192         // step 3: store all these attributes in an array
193
OneAttr[] allAttrs = new OneAttr[attCount];
194         allAttrs[ATT_ABSTRACT_D] = new OneAttr(SchemaSymbols.ATT_ABSTRACT,
195                                                         DT_BOOLEAN,
196                                                         ATT_OPT_DFLT,
197                                                         SchemaSymbols.ATTVAL_FALSE);
198         allAttrs[ATT_ATTRIBUTE_FD_D] = new OneAttr(SchemaSymbols.ATT_ATTRIBUTEFORMDEFAULT,
199                                                         DT_FORM,
200                                                         ATT_OPT_DFLT,
201                                                         SchemaSymbols.ATTVAL_UNQUALIFIED);
202         allAttrs[ATT_BASE_R] = new OneAttr(SchemaSymbols.ATT_BASE,
203                                                         DT_QNAME,
204                                                         ATT_REQUIRED,
205                                                         null);
206         allAttrs[ATT_BASE_N] = new OneAttr(SchemaSymbols.ATT_BASE,
207                                                         DT_QNAME,
208                                                         ATT_OPT_NODFLT,
209                                                         null);
210         allAttrs[ATT_BLOCK_N] = new OneAttr(SchemaSymbols.ATT_BLOCK,
211                                                         DT_BLOCK,
212                                                         ATT_OPT_NODFLT,
213                                                         null);
214         allAttrs[ATT_BLOCK1_N] = new OneAttr(SchemaSymbols.ATT_BLOCK,
215                                                         DT_BLOCK1,
216                                                         ATT_OPT_NODFLT,
217                                                         null);
218         allAttrs[ATT_BLOCK_D_D] = new OneAttr(SchemaSymbols.ATT_BLOCKDEFAULT,
219                                                         DT_BLOCK,
220                                                         ATT_OPT_DFLT,
221                                                         "");
222         allAttrs[ATT_DEFAULT_N] = new OneAttr(SchemaSymbols.ATT_DEFAULT,
223                                                         DT_STRING,
224                                                         ATT_OPT_NODFLT,
225                                                         null);
226         allAttrs[ATT_ELEMENT_FD_D] = new OneAttr(SchemaSymbols.ATT_ELEMENTFORMDEFAULT,
227                                                         DT_FORM,
228                                                         ATT_OPT_DFLT,
229                                                         SchemaSymbols.ATTVAL_UNQUALIFIED);
230         allAttrs[ATT_FINAL_N] = new OneAttr(SchemaSymbols.ATT_FINAL,
231                                                         DT_FINAL,
232                                                         ATT_OPT_NODFLT,
233                                                         null);
234         allAttrs[ATT_FINAL1_N] = new OneAttr(SchemaSymbols.ATT_FINAL,
235                                                         DT_FINAL1,
236                                                         ATT_OPT_NODFLT,
237                                                         null);
238         allAttrs[ATT_FINAL_D_D] = new OneAttr(SchemaSymbols.ATT_FINALDEFAULT,
239                                                         DT_FINAL,
240                                                         ATT_OPT_DFLT,
241                                                         "");
242         allAttrs[ATT_FIXED_N] = new OneAttr(SchemaSymbols.ATT_FIXED,
243                                                         DT_STRING,
244                                                         ATT_OPT_NODFLT,
245                                                         null);
246         allAttrs[ATT_FIXED_D] = new OneAttr(SchemaSymbols.ATT_FIXED,
247                                                         DT_BOOLEAN,
248                                                         ATT_OPT_DFLT,
249                                                         SchemaSymbols.ATTVAL_FALSE);
250         allAttrs[ATT_FORM_N] = new OneAttr(SchemaSymbols.ATT_FORM,
251                                                         DT_FORM,
252                                                         ATT_OPT_NODFLT,
253                                                         null);
254         allAttrs[ATT_ID_N] = new OneAttr(SchemaSymbols.ATT_ID,
255                                                         DT_ID,
256                                                         ATT_OPT_NODFLT,
257                                                         null);
258         allAttrs[ATT_ITEMTYPE_N] = new OneAttr(SchemaSymbols.ATT_ITEMTYPE,
259                                                         DT_QNAME,
260                                                         ATT_OPT_NODFLT,
261                                                         null);
262         allAttrs[ATT_MAXOCCURS_D] = new OneAttr(SchemaSymbols.ATT_MAXOCCURS,
263                                                         DT_MAXOCCURS,
264                                                         ATT_OPT_DFLT,
265                                                         "1");
266         allAttrs[ATT_MAXOCCURS1_D] = new OneAttr(SchemaSymbols.ATT_MAXOCCURS,
267                                                         DT_MAXOCCURS1,
268                                                         ATT_OPT_DFLT,
269                                                         "1");
270         allAttrs[ATT_MEMBER_T_N] = new OneAttr(SchemaSymbols.ATT_MEMBERTYPES,
271                                                         DT_MEMBERTYPES,
272                                                         ATT_OPT_NODFLT,
273                                                         null);
274         allAttrs[ATT_MINOCCURS_D] = new OneAttr(SchemaSymbols.ATT_MINOCCURS,
275                                                         DT_NONNEGINT,
276                                                         ATT_OPT_DFLT,
277                                                         "1");
278         allAttrs[ATT_MINOCCURS1_D] = new OneAttr(SchemaSymbols.ATT_MINOCCURS,
279                                                         DT_MINOCCURS1,
280                                                         ATT_OPT_DFLT,
281                                                         "1");
282         allAttrs[ATT_MIXED_D] = new OneAttr(SchemaSymbols.ATT_MIXED,
283                                                         DT_BOOLEAN,
284                                                         ATT_OPT_DFLT,
285                                                         SchemaSymbols.ATTVAL_FALSE);
286         allAttrs[ATT_MIXED_N] = new OneAttr(SchemaSymbols.ATT_MIXED,
287                                                         DT_BOOLEAN,
288                                                         ATT_OPT_NODFLT,
289                                                         null);
290         allAttrs[ATT_NAME_R] = new OneAttr(SchemaSymbols.ATT_NAME,
291                                                         DT_NCNAME,
292                                                         ATT_REQUIRED,
293                                                         null);
294         allAttrs[ATT_NAMESPACE_D] = new OneAttr(SchemaSymbols.ATT_NAMESPACE,
295                                                         DT_NAMESPACE,
296                                                         ATT_OPT_DFLT,
297                                                         SchemaSymbols.ATTVAL_TWOPOUNDANY);
298         allAttrs[ATT_NAMESPACE_N] = new OneAttr(SchemaSymbols.ATT_NAMESPACE,
299                                                         DT_ANYURI,
300                                                         ATT_OPT_NODFLT,
301                                                         null);
302         allAttrs[ATT_NILLABLE_D] = new OneAttr(SchemaSymbols.ATT_NILLABLE,
303                                                         DT_BOOLEAN,
304                                                         ATT_OPT_DFLT,
305                                                         SchemaSymbols.ATTVAL_FALSE);
306         allAttrs[ATT_PROCESS_C_D] = new OneAttr(SchemaSymbols.ATT_PROCESSCONTENTS,
307                                                         DT_PROCESSCONTENTS,
308                                                         ATT_OPT_DFLT,
309                                                         SchemaSymbols.ATTVAL_STRICT);
310         allAttrs[ATT_PUBLIC_R] = new OneAttr(SchemaSymbols.ATT_PUBLIC,
311                                                         DT_PUBLIC,
312                                                         ATT_REQUIRED,
313                                                         null);
314         allAttrs[ATT_REF_R] = new OneAttr(SchemaSymbols.ATT_REF,
315                                                         DT_QNAME,
316                                                         ATT_REQUIRED,
317                                                         null);
318         allAttrs[ATT_REFER_R] = new OneAttr(SchemaSymbols.ATT_REFER,
319                                                         DT_QNAME,
320                                                         ATT_REQUIRED,
321                                                         null);
322         allAttrs[ATT_SCHEMA_L_R] = new OneAttr(SchemaSymbols.ATT_SCHEMALOCATION,
323                                                         DT_ANYURI,
324                                                         ATT_REQUIRED,
325                                                         null);
326         allAttrs[ATT_SCHEMA_L_N] = new OneAttr(SchemaSymbols.ATT_SCHEMALOCATION,
327                                                         DT_ANYURI,
328                                                         ATT_OPT_NODFLT,
329                                                         null);
330         allAttrs[ATT_SOURCE_N] = new OneAttr(SchemaSymbols.ATT_SOURCE,
331                                                         DT_ANYURI,
332                                                         ATT_OPT_NODFLT,
333                                                         null);
334         allAttrs[ATT_SUBSTITUTION_G_N] = new OneAttr(SchemaSymbols.ATT_SUBSTITUTIONGROUP,
335                                                         DT_QNAME,
336                                                         ATT_OPT_NODFLT,
337                                                         null);
338         allAttrs[ATT_SYSTEM_N] = new OneAttr(SchemaSymbols.ATT_SYSTEM,
339                                                         DT_ANYURI,
340                                                         ATT_OPT_NODFLT,
341                                                         null);
342         allAttrs[ATT_TARGET_N_N] = new OneAttr(SchemaSymbols.ATT_TARGETNAMESPACE,
343                                                         DT_ANYURI,
344                                                         ATT_OPT_NODFLT,
345                                                         null);
346         allAttrs[ATT_TYPE_N] = new OneAttr(SchemaSymbols.ATT_TYPE,
347                                                         DT_QNAME,
348                                                         ATT_OPT_NODFLT,
349                                                         null);
350         allAttrs[ATT_USE_D] = new OneAttr(SchemaSymbols.ATT_USE,
351                                                         DT_USE,
352                                                         ATT_OPT_DFLT,
353                                                         SchemaSymbols.ATTVAL_OPTIONAL);
354         allAttrs[ATT_VALUE_NNI_N] = new OneAttr(SchemaSymbols.ATT_VALUE,
355                                                         DT_NONNEGINT,
356                                                         ATT_OPT_NODFLT,
357                                                         null);
358         allAttrs[ATT_VALUE_STR_N] = new OneAttr(SchemaSymbols.ATT_VALUE,
359                                                         DT_STRING,
360                                                         ATT_OPT_NODFLT,
361                                                         null);
362         allAttrs[ATT_VALUE_WS_N] = new OneAttr(SchemaSymbols.ATT_VALUE,
363                                                         DT_WHITESPACE,
364                                                         ATT_OPT_NODFLT,
365                                                         null);
366         allAttrs[ATT_VERSION_N] = new OneAttr(SchemaSymbols.ATT_VERSION,
367                                                         DT_TOKEN,
368                                                         ATT_OPT_NODFLT,
369                                                         null);
370         allAttrs[ATT_XPATH_R] = new OneAttr(SchemaSymbols.ATT_XPATH,
371                                                         DT_XPATH,
372                                                         ATT_REQUIRED,
373                                                         null);
374         allAttrs[ATT_XPATH1_R] = new OneAttr(SchemaSymbols.ATT_XPATH,
375                                                         DT_XPATH1,
376                                                         ATT_REQUIRED,
377                                                         null);
378
379         // step 4: for each element, make a list of possible attributes
380
Hashtable JavaDoc attrList;
381         Object JavaDoc[] attrArray;
382         OneElement oneEle;
383
384         // for element "attribute" - global
385
attrList = new Hashtable JavaDoc();
386         // default = string
387
attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
388         // fixed = string
389
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
390         // id = ID
391
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
392         // name = NCName
393
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
394         // type = QName
395
attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
396         oneEle = new OneElement (attrList);
397         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_ATTRIBUTE, oneEle);
398
399         // for element "attribute" - local name
400
attrList = new Hashtable JavaDoc();
401         // default = string
402
attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
403         // fixed = string
404
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
405         // form = (qualified | unqualified)
406
attrList.put(SchemaSymbols.ATT_FORM, allAttrs[ATT_FORM_N]);
407         // id = ID
408
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
409         // name = NCName
410
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
411         // type = QName
412
attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
413         // use = (optional | prohibited | required) : optional
414
attrList.put(SchemaSymbols.ATT_USE, allAttrs[ATT_USE_D]);
415         oneEle = new OneElement (attrList);
416         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_ATTRIBUTE, oneEle);
417
418         // for element "attribute" - local ref
419
attrList = new Hashtable JavaDoc();
420         // default = string
421
attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
422         // fixed = string
423
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
424         // id = ID
425
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
426         // ref = QName
427
attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
428         // use = (optional | prohibited | required) : optional
429
attrList.put(SchemaSymbols.ATT_USE, allAttrs[ATT_USE_D]);
430         oneEle = new OneElement (attrList);
431         fEleAttrsMap.put(PRE_LOC_REF+SchemaSymbols.ELT_ATTRIBUTE, oneEle);
432
433         // for element "element" - global
434
attrList = new Hashtable JavaDoc();
435         // abstract = boolean : false
436
attrList.put(SchemaSymbols.ATT_ABSTRACT, allAttrs[ATT_ABSTRACT_D]);
437         // block = (#all | List of (substitution | extension | restriction | list | union))
438
attrList.put(SchemaSymbols.ATT_BLOCK, allAttrs[ATT_BLOCK_N]);
439         // default = string
440
attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
441         // final = (#all | List of (extension | restriction))
442
attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL_N]);
443         // fixed = string
444
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
445         // id = ID
446
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
447         // name = NCName
448
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
449         // nillable = boolean : false
450
attrList.put(SchemaSymbols.ATT_NILLABLE, allAttrs[ATT_NILLABLE_D]);
451         // substitutionGroup = QName
452
attrList.put(SchemaSymbols.ATT_SUBSTITUTIONGROUP, allAttrs[ATT_SUBSTITUTION_G_N]);
453         // type = QName
454
attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
455         oneEle = new OneElement (attrList);
456         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_ELEMENT, oneEle);
457
458         // for element "element" - local name
459
attrList = new Hashtable JavaDoc();
460         // block = (#all | List of (substitution | extension | restriction | list | union))
461
attrList.put(SchemaSymbols.ATT_BLOCK, allAttrs[ATT_BLOCK_N]);
462         // default = string
463
attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
464         // fixed = string
465
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
466         // form = (qualified | unqualified)
467
attrList.put(SchemaSymbols.ATT_FORM, allAttrs[ATT_FORM_N]);
468         // id = ID
469
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
470         // maxOccurs = (nonNegativeInteger | unbounded) : 1
471
attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
472         // minOccurs = nonNegativeInteger : 1
473
attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
474         // name = NCName
475
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
476         // nillable = boolean : false
477
attrList.put(SchemaSymbols.ATT_NILLABLE, allAttrs[ATT_NILLABLE_D]);
478         // type = QName
479
attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
480         oneEle = new OneElement (attrList);
481         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_ELEMENT, oneEle);
482
483         // for element "element" - local ref
484
attrList = new Hashtable JavaDoc();
485         // id = ID
486
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
487         // maxOccurs = (nonNegativeInteger | unbounded) : 1
488
attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
489         // minOccurs = nonNegativeInteger : 1
490
attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
491         // ref = QName
492
attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
493         oneEle = new OneElement (attrList);
494         fEleAttrsMap.put(PRE_LOC_REF+SchemaSymbols.ELT_ELEMENT, oneEle);
495
496         // for element "complexType" - global
497
attrList = new Hashtable JavaDoc();
498         // abstract = boolean : false
499
attrList.put(SchemaSymbols.ATT_ABSTRACT, allAttrs[ATT_ABSTRACT_D]);
500         // block = (#all | List of (extension | restriction))
501
attrList.put(SchemaSymbols.ATT_BLOCK, allAttrs[ATT_BLOCK1_N]);
502         // final = (#all | List of (extension | restriction))
503
attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL_N]);
504         // id = ID
505
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
506         // mixed = boolean : false
507
attrList.put(SchemaSymbols.ATT_MIXED, allAttrs[ATT_MIXED_D]);
508         // name = NCName
509
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
510         oneEle = new OneElement (attrList);
511         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_COMPLEXTYPE, oneEle);
512
513         // for element "complexType" - local name
514
attrList = new Hashtable JavaDoc();
515         // id = ID
516
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
517         // mixed = boolean : false
518
attrList.put(SchemaSymbols.ATT_MIXED, allAttrs[ATT_MIXED_D]);
519         oneEle = new OneElement (attrList);
520         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_COMPLEXTYPE, oneEle);
521
522         // for element "simpleContent" - local name
523
attrList = new Hashtable JavaDoc();
524         // id = ID
525
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
526         oneEle = new OneElement (attrList);
527         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_SIMPLECONTENT, oneEle);
528
529         // for element "restriction" - local name
530
attrList = new Hashtable JavaDoc();
531         // base = QName
532
attrList.put(SchemaSymbols.ATT_BASE, allAttrs[ATT_BASE_N]);
533         // id = ID
534
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
535         oneEle = new OneElement (attrList);
536         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_RESTRICTION, oneEle);
537
538         // for element "extension" - local name
539
attrList = new Hashtable JavaDoc();
540         // base = QName
541
attrList.put(SchemaSymbols.ATT_BASE, allAttrs[ATT_BASE_R]);
542         // id = ID
543
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
544         oneEle = new OneElement (attrList);
545         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_EXTENSION, oneEle);
546
547         // for element "attributeGroup" - local ref
548
attrList = new Hashtable JavaDoc();
549         // id = ID
550
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
551         // ref = QName
552
attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
553         oneEle = new OneElement (attrList);
554         fEleAttrsMap.put(PRE_LOC_REF+SchemaSymbols.ELT_ATTRIBUTEGROUP, oneEle);
555
556         // for element "anyAttribute" - local name
557
attrList = new Hashtable JavaDoc();
558         // id = ID
559
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
560         // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any
561
attrList.put(SchemaSymbols.ATT_NAMESPACE, allAttrs[ATT_NAMESPACE_D]);
562         // processContents = (lax | skip | strict) : strict
563
attrList.put(SchemaSymbols.ATT_PROCESSCONTENTS, allAttrs[ATT_PROCESS_C_D]);
564         oneEle = new OneElement (attrList);
565         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_ANYATTRIBUTE, oneEle);
566
567         // for element "complexContent" - local name
568
attrList = new Hashtable JavaDoc();
569         // id = ID
570
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
571         // mixed = boolean
572
attrList.put(SchemaSymbols.ATT_MIXED, allAttrs[ATT_MIXED_N]);
573         oneEle = new OneElement (attrList);
574         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_COMPLEXCONTENT, oneEle);
575
576         // for element "attributeGroup" - global
577
attrList = new Hashtable JavaDoc();
578         // id = ID
579
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
580         // name = NCName
581
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
582         oneEle = new OneElement (attrList);
583         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_ATTRIBUTEGROUP, oneEle);
584
585         // for element "group" - global
586
attrList = new Hashtable JavaDoc();
587         // id = ID
588
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
589         // name = NCName
590
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
591         oneEle = new OneElement (attrList);
592         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_GROUP, oneEle);
593
594         // for element "group" - local ref
595
attrList = new Hashtable JavaDoc();
596         // id = ID
597
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
598         // maxOccurs = (nonNegativeInteger | unbounded) : 1
599
attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
600         // minOccurs = nonNegativeInteger : 1
601
attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
602         // ref = QName
603
attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
604         oneEle = new OneElement (attrList);
605         fEleAttrsMap.put(PRE_LOC_REF+SchemaSymbols.ELT_GROUP, oneEle);
606
607         // for element "all" - local name
608
attrList = new Hashtable JavaDoc();
609         // id = ID
610
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
611         // maxOccurs = 1 : 1
612
attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS1_D]);
613         // minOccurs = (0 | 1) : 1
614
attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS1_D]);
615         oneEle = new OneElement (attrList);
616         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_ALL, oneEle);
617
618         // for element "choice" - local name
619
attrList = new Hashtable JavaDoc();
620         // id = ID
621
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
622         // maxOccurs = (nonNegativeInteger | unbounded) : 1
623
attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
624         // minOccurs = nonNegativeInteger : 1
625
attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
626         oneEle = new OneElement (attrList);
627         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_CHOICE, oneEle);
628         // for element "sequence" - local name
629
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_SEQUENCE, oneEle);
630
631         // for element "any" - local name
632
attrList = new Hashtable JavaDoc();
633         // id = ID
634
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
635         // maxOccurs = (nonNegativeInteger | unbounded) : 1
636
attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
637         // minOccurs = nonNegativeInteger : 1
638
attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
639         // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any
640
attrList.put(SchemaSymbols.ATT_NAMESPACE, allAttrs[ATT_NAMESPACE_D]);
641         // processContents = (lax | skip | strict) : strict
642
attrList.put(SchemaSymbols.ATT_PROCESSCONTENTS, allAttrs[ATT_PROCESS_C_D]);
643         oneEle = new OneElement (attrList);
644         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_ANY, oneEle);
645
646         // for element "unique" - local name
647
attrList = new Hashtable JavaDoc();
648         // id = ID
649
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
650         // name = NCName
651
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
652         oneEle = new OneElement (attrList);
653         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_UNIQUE, oneEle);
654         // for element "key" - local name
655
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_KEY, oneEle);
656
657         // for element "keyref" - local name
658
attrList = new Hashtable JavaDoc();
659         // id = ID
660
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
661         // name = NCName
662
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
663         // refer = QName
664
attrList.put(SchemaSymbols.ATT_REFER, allAttrs[ATT_REFER_R]);
665         oneEle = new OneElement (attrList);
666         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_KEYREF, oneEle);
667
668         // for element "selector" - local name
669
attrList = new Hashtable JavaDoc();
670         // id = ID
671
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
672         // xpath = a subset of XPath expression
673
attrList.put(SchemaSymbols.ATT_XPATH, allAttrs[ATT_XPATH_R]);
674         oneEle = new OneElement (attrList);
675         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_SELECTOR, oneEle);
676
677         // for element "field" - local name
678
attrList = new Hashtable JavaDoc();
679         // id = ID
680
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
681         // xpath = a subset of XPath expression
682
attrList.put(SchemaSymbols.ATT_XPATH, allAttrs[ATT_XPATH1_R]);
683         oneEle = new OneElement (attrList);
684         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_FIELD, oneEle);
685
686         // for element "notation" - local name
687
attrList = new Hashtable JavaDoc();
688         // id = ID
689
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
690         // name = NCName
691
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
692         // public = A public identifier, per ISO 8879
693
attrList.put(SchemaSymbols.ATT_PUBLIC, allAttrs[ATT_PUBLIC_R]);
694         // system = anyURI
695
attrList.put(SchemaSymbols.ATT_SYSTEM, allAttrs[ATT_SYSTEM_N]);
696         oneEle = new OneElement (attrList);
697         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_NOTATION, oneEle);
698
699         // for element "annotation" - global
700
attrList = new Hashtable JavaDoc();
701         // id = ID
702
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
703         oneEle = new OneElement (attrList);
704         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_ANNOTATION, oneEle);
705         // for element "annotation" - local name
706
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_ANNOTATION, oneEle);
707
708         // for element "appinfo" - local name
709
attrList = new Hashtable JavaDoc();
710         // source = anyURI
711
attrList.put(SchemaSymbols.ATT_SOURCE, allAttrs[ATT_SOURCE_N]);
712         oneEle = new OneElement (attrList, false);
713         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_APPINFO, oneEle);
714
715         // for element "documentation" - local name
716
attrList = new Hashtable JavaDoc();
717         // source = anyURI
718
attrList.put(SchemaSymbols.ATT_SOURCE, allAttrs[ATT_SOURCE_N]);
719         // xml:lang = language ???
720
oneEle = new OneElement (attrList, false);
721         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_DOCUMENTATION, oneEle);
722
723         // for element "simpleType" - global
724
attrList = new Hashtable JavaDoc();
725         // final = (#all | (list | union | restriction))
726
attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL1_N]);
727         // id = ID
728
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
729         // name = NCName
730
attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
731         oneEle = new OneElement (attrList);
732         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_SIMPLETYPE, oneEle);
733
734         // for element "simpleType" - local name
735
attrList = new Hashtable JavaDoc();
736         // final = (#all | (list | union | restriction))
737
attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL1_N]);
738         // id = ID
739
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
740         oneEle = new OneElement (attrList);
741         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_SIMPLETYPE, oneEle);
742
743         // for element "restriction" - local name
744
// already registered for complexType
745

746         // for element "list" - local name
747
attrList = new Hashtable JavaDoc();
748         // id = ID
749
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
750         // itemType = QName
751
attrList.put(SchemaSymbols.ATT_ITEMTYPE, allAttrs[ATT_ITEMTYPE_N]);
752         oneEle = new OneElement (attrList);
753         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_LIST, oneEle);
754
755         // for element "union" - local name
756
attrList = new Hashtable JavaDoc();
757         // id = ID
758
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
759         // memberTypes = List of QName
760
attrList.put(SchemaSymbols.ATT_MEMBERTYPES, allAttrs[ATT_MEMBER_T_N]);
761         oneEle = new OneElement (attrList);
762         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_UNION, oneEle);
763
764         // for element "schema" - global
765
attrList = new Hashtable JavaDoc();
766         // attributeFormDefault = (qualified | unqualified) : unqualified
767
attrList.put(SchemaSymbols.ATT_ATTRIBUTEFORMDEFAULT, allAttrs[ATT_ATTRIBUTE_FD_D]);
768         // blockDefault = (#all | List of (substitution | extension | restriction | list | union)) : ''
769
attrList.put(SchemaSymbols.ATT_BLOCKDEFAULT, allAttrs[ATT_BLOCK_D_D]);
770         // elementFormDefault = (qualified | unqualified) : unqualified
771
attrList.put(SchemaSymbols.ATT_ELEMENTFORMDEFAULT, allAttrs[ATT_ELEMENT_FD_D]);
772         // finalDefault = (#all | List of (extension | restriction)) : ''
773
attrList.put(SchemaSymbols.ATT_FINALDEFAULT, allAttrs[ATT_FINAL_D_D]);
774         // id = ID
775
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
776         // targetNamespace = anyURI
777
attrList.put(SchemaSymbols.ATT_TARGETNAMESPACE, allAttrs[ATT_TARGET_N_N]);
778         // version = token
779
attrList.put(SchemaSymbols.ATT_VERSION, allAttrs[ATT_VERSION_N]);
780         // xml:lang = language ???
781
oneEle = new OneElement (attrList);
782         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_SCHEMA, oneEle);
783
784         // for element "include" - global
785
attrList = new Hashtable JavaDoc();
786         // id = ID
787
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
788         // schemaLocation = anyURI
789
attrList.put(SchemaSymbols.ATT_SCHEMALOCATION, allAttrs[ATT_SCHEMA_L_R]);
790         oneEle = new OneElement (attrList);
791         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_INCLUDE, oneEle);
792         // for element "redefine" - global
793
fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_REDEFINE, oneEle);
794
795         // for element "import" - global
796
attrList = new Hashtable JavaDoc();
797         // id = ID
798
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
799         // namespace = anyURI
800
attrList.put(SchemaSymbols.ATT_NAMESPACE, allAttrs[ATT_NAMESPACE_N]);
801         // schemaLocation = anyURI
802
attrList.put(SchemaSymbols.ATT_SCHEMALOCATION, allAttrs[ATT_SCHEMA_L_N]);
803         oneEle = new OneElement (attrList);
804         fEleAttrsMap.put(PRE_GLOBAL+SchemaSymbols.ELT_IMPORT, oneEle);
805
806         // for element "length" - local name
807
attrList = new Hashtable JavaDoc();
808         // id = ID
809
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
810         // value = nonNegativeInteger
811
attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_NNI_N]);
812         // fixed = boolean : false
813
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
814         oneEle = new OneElement (attrList);
815         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_LENGTH, oneEle);
816         // for element "minLength" - local name
817
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_MINLENGTH, oneEle);
818         // for element "maxLength" - local name
819
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_MAXLENGTH, oneEle);
820         // for element "totalDigits" - local name
821
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_TOTALDIGITS, oneEle);
822         // for element "fractionDigits" - local name
823
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_FRACTIONDIGITS, oneEle);
824
825         // for element "pattern" - local name
826
attrList = new Hashtable JavaDoc();
827         // id = ID
828
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
829         // value = string
830
attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]);
831         oneEle = new OneElement (attrList);
832         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_PATTERN, oneEle);
833
834         // for element "enumeration" - local name
835
attrList = new Hashtable JavaDoc();
836         // id = ID
837
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
838         // value = anySimpleType ???
839
attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]);
840         oneEle = new OneElement (attrList);
841         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_ENUMERATION, oneEle);
842
843         // for element "whiteSpace" - local name
844
attrList = new Hashtable JavaDoc();
845         // id = ID
846
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
847         // value = preserve | replace | collapse
848
attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_WS_N]);
849         // fixed = boolean : false
850
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
851         oneEle = new OneElement (attrList);
852         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_WHITESPACE, oneEle);
853
854         // for element "maxInclusive" - local name
855
attrList = new Hashtable JavaDoc();
856         // id = ID
857
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
858         // value = anySimpleType ???
859
attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]);
860         // fixed = boolean : false
861
attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
862         oneEle = new OneElement (attrList);
863         fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_MAXINCLUSIVE, oneEle);
864         // for element "maxExclusive" - local name
865
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_MAXEXCLUSIVE, oneEle);
866         // for element "minInclusive" - local name
867
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_MININCLUSIVE, oneEle);
868         // for element "minExclusive" - local name
869
fEleAttrsMap.put(PRE_LOC_NAME+SchemaSymbols.ELT_MINEXCLUSIVE, oneEle);
870     }
871
872     private Hashtable JavaDoc fIdDefs = new Hashtable JavaDoc();
873
874     // used to store utility reference: error reproter. set via constructor.
875
protected XMLErrorReporter fErrorReporter = null;
876
877     // used to store the mapping from processed element to attributes
878
protected Hashtable JavaDoc fProcessedElements = new Hashtable JavaDoc();
879
880     // used to store the mapping from processed element to attributes
881
protected Hashtable JavaDoc fNonSchemaAttrs = new Hashtable JavaDoc();
882
883     // constructor. Sets fDVRegistry and fErrorReproter
884
private GeneralAttrCheck() {}
885     public GeneralAttrCheck (XMLErrorReporter er, DatatypeValidatorFactoryImpl datatypeRegistry) {
886         fErrorReporter = er;
887         synchronized (getClass()) {
888             if (fExtraDVs[DT_ANYURI] == null) {
889                 // step 5: register all datatype validators for new types
890
datatypeRegistry.expandRegistryToFullSchemaSet();
891                 // anyURI
892
fExtraDVs[DT_ANYURI] = datatypeRegistry.getDatatypeValidator("anyURI");
893                 // boolean
894
fExtraDVs[DT_BOOLEAN] = datatypeRegistry.getDatatypeValidator("boolean");
895                 // ID
896
fExtraDVs[DT_ID] = datatypeRegistry.getDatatypeValidator("ID");
897                 // nonNegtiveInteger
898
fExtraDVs[DT_NONNEGINT] = datatypeRegistry.getDatatypeValidator("nonNegativeInteger");
899                 // QName
900
fExtraDVs[DT_QNAME] = datatypeRegistry.getDatatypeValidator("QName");
901                 // string
902
fExtraDVs[DT_STRING] = datatypeRegistry.getDatatypeValidator("string");
903                 // token
904
fExtraDVs[DT_TOKEN] = datatypeRegistry.getDatatypeValidator("token");
905                 // NCName
906
fExtraDVs[DT_NCNAME] = datatypeRegistry.getDatatypeValidator("NCName");
907                 // xpath = a subset of XPath expression
908
fExtraDVs[DT_XPATH] = fExtraDVs[DT_STRING];
909                 // xpath = a subset of XPath expression
910
fExtraDVs[DT_XPATH] = fExtraDVs[DT_STRING];
911             }
912         }
913     }
914
915     // check whether the specified element conforms to the attributes restriction
916
// @param: element - which element to check
917
// @param: eleContext - the context in which the element is
918
// @return: Hashtable - list of attributes and values
919
public Hashtable JavaDoc checkAttributes(Element JavaDoc element, int eleContext) throws Exception JavaDoc {
920         if (element == null)
921             return null;
922
923         Hashtable JavaDoc attrValues = (Hashtable JavaDoc)fProcessedElements.get(element);
924         if (attrValues != null)
925             return attrValues;
926
927         // Get the proper name:
928
// G_ for global;
929
// LN_ for local + name;
930
// LR_ for local + ref;
931
String JavaDoc elName = element.getLocalName(), name;
932         if (eleContext == ELE_CONTEXT_GLOBAL) {
933             name = PRE_GLOBAL + elName;
934         } else {
935             if (element.getAttributeNode(SchemaSymbols.ATT_REF) == null)
936                 name = PRE_LOC_NAME + elName;
937             else
938                 name = PRE_LOC_REF + elName;
939         }
940
941         // get desired attribute list of this element
942
OneElement oneEle = (OneElement)fEleAttrsMap.get(name);
943         if (oneEle == null) {
944             reportSchemaError (SchemaMessageProvider.Con3X3ElementAppearance,
945                                new Object JavaDoc[] {elName});
946             return null;
947         }
948
949         attrValues = new Hashtable JavaDoc();
950         Hashtable JavaDoc attrList = oneEle.attrList;
951
952         // traverse all attributes
953
NamedNodeMap JavaDoc attrs = element.getAttributes();
954         Attr JavaDoc sattr = null;
955         int i = 0;
956         while ((sattr = (Attr JavaDoc)attrs.item(i++)) != null) {
957             // get the attribute name/value
958
String JavaDoc attrName = sattr.getName();
959             String JavaDoc attrVal = sattr.getValue();
960
961             // skip anything starts with x/X m/M l/L ???
962
// simply put their values in the return hashtable
963
if (attrName.toLowerCase().startsWith("xml")) {
964                 attrValues.put(attrName, new Object JavaDoc[] {sattr.getValue(), Boolean.FALSE});
965                 continue;
966             }
967
968             // for attributes with namespace prefix
969
String JavaDoc attrURI = sattr.getNamespaceURI();
970             if (attrURI != null && attrURI.length() != 0) {
971                 // attributes with schema namespace are not allowed
972
// and not allowed on "document" and "appInfo"
973
if (attrURI.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA) ||
974                     !oneEle.allowNonSchemaAttr) {
975                     reportSchemaError (SchemaMessageProvider.Con3X3AttributeAppearance,
976                                        new Object JavaDoc[] {elName, attrName});
977                 } else {
978                     // for attributes from other namespace
979
// store them in a list, and TRY to validate them after
980
// schema traversal (because it's "lax")
981
attrValues.put(attrName,
982                                    new Object JavaDoc[] {attrVal, Boolean.FALSE});
983                     String JavaDoc attrRName = attrURI + "," + sattr.getLocalName();
984                     Vector JavaDoc values = (Vector JavaDoc)fNonSchemaAttrs.get(attrRName);
985                     if (values == null) {
986                         values = new Vector JavaDoc();
987                         values.addElement(attrName);
988                         values.addElement(elName);
989                         values.addElement(attrVal);
990                         fNonSchemaAttrs.put(attrRName, values);
991                     } else {
992                         values.addElement(elName);
993                         values.addElement(attrVal);
994                     }
995                 }
996                 continue;
997             }
998
999             // check whether this attribute is allowed
1000
OneAttr oneAttr = (OneAttr)attrList.get(attrName);
1001            if (oneAttr == null) {
1002                reportSchemaError (SchemaMessageProvider.Con3X3AttributeAppearance,
1003                                   new Object JavaDoc[] {elName, attrName});
1004                continue;
1005            }
1006
1007            // check the value against the datatype
1008
try {
1009                // no checking on string needs to be done here.
1010
// no checking on xpath needs to be done here.
1011
// xpath values are validated in xpath parser
1012
if (oneAttr.dvIndex >= 0) {
1013                    if (oneAttr.dvIndex != DT_STRING &&
1014                        oneAttr.dvIndex != DT_XPATH &&
1015                        oneAttr.dvIndex != DT_XPATH1) {
1016                        DatatypeValidator dv = fExtraDVs[oneAttr.dvIndex];
1017                        if (dv instanceof IDDatatypeValidator) {
1018                            dv.validate( attrVal, fIdDefs );
1019                        } else {
1020                            dv.validate( attrVal, null);
1021                        }
1022                    }
1023                    attrValues.put(attrName, new Object JavaDoc[] {attrVal, Boolean.FALSE});
1024                } else {
1025                    attrVal = validate(attrName, attrVal, oneAttr.dvIndex);
1026                    attrValues.put(attrName, new Object JavaDoc[] {attrVal, Boolean.FALSE});
1027                }
1028            } catch(InvalidDatatypeValueException ide) {
1029                reportSchemaError (SchemaMessageProvider.Con3X3AttributeInvalidValue,
1030                                   new Object JavaDoc[] {elName, attrName, ide.getLocalizedMessage()});
1031            }
1032        }
1033
1034        // traverse all required attributes
1035
Object JavaDoc[] reqAttrs = oneEle.attrArray;
1036        for (i = 0; i < reqAttrs.length; i++) {
1037            OneAttr oneAttr = (OneAttr)reqAttrs[i];
1038
1039            // if the attribute appreared, skip to the next one
1040
if (element.getAttributeNode(oneAttr.name) != null)
1041                continue;
1042
1043            // if the attribute is required, report an error
1044
if (oneAttr.optdflt == ATT_REQUIRED) {
1045                reportSchemaError (SchemaMessageProvider.Con3X3AttributeMustAppear,
1046                                   new Object JavaDoc[] {elName, oneAttr.name});
1047            }
1048            // if the attribute is optional with default value, apply it
1049
else if (oneAttr.optdflt == ATT_OPT_DFLT) {
1050                attrValues.put(oneAttr.name, new Object JavaDoc[] {oneAttr.dfltValue, Boolean.TRUE});
1051            }
1052        }
1053
1054        fProcessedElements.put(element, attrValues);
1055
1056        return attrValues;
1057    }
1058
1059    private String JavaDoc validate(String JavaDoc attr, String JavaDoc value, int dvIndex) throws InvalidDatatypeValueException {
1060        Vector JavaDoc unionBase, enumer;
1061        int choice;
1062
1063        if (value == null)
1064            return null;
1065
1066        switch (dvIndex) {
1067        case DT_BLOCK:
1068            // block = (#all | List of (substitution | extension | restriction | list | union))
1069
choice = 0;
1070            if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
1071                choice = SchemaSymbols.SUBSTITUTION|SchemaSymbols.EXTENSION|
1072                         SchemaSymbols.RESTRICTION|SchemaSymbols.LIST|
1073                         SchemaSymbols.UNION;
1074            } else {
1075                StringTokenizer JavaDoc t = new StringTokenizer JavaDoc (value, " ");
1076                while (t.hasMoreTokens()) {
1077                    String JavaDoc token = t.nextToken ();
1078
1079                    if (token.equals (SchemaSymbols.ATTVAL_SUBSTITUTION) ) {
1080                        choice |= SchemaSymbols.SUBSTITUTION;
1081                    } else if (token.equals (SchemaSymbols.ATTVAL_EXTENSION)) {
1082                        choice |= SchemaSymbols.EXTENSION;
1083                    } else if (token.equals (SchemaSymbols.ATTVAL_RESTRICTION)) {
1084                        choice |= SchemaSymbols.RESTRICTION;
1085                    } else if ( token.equals (SchemaSymbols.ELT_LIST) ) {
1086                        choice |= SchemaSymbols.LIST;
1087                    } else if ( token.equals (SchemaSymbols.ELT_UNION) ) {
1088                        choice |= SchemaSymbols.RESTRICTION;
1089                    } else {
1090                        throw new InvalidDatatypeValueException("the value '"+value+"' must match (#all | List of (substitution | extension | restriction | list | union))");
1091                    }
1092                }
1093            }
1094//??? value = Integer.toString(choice);
1095
break;
1096        case DT_BLOCK1:
1097        case DT_FINAL:
1098            // block = (#all | List of (extension | restriction))
1099
// final = (#all | List of (extension | restriction))
1100
choice = 0;
1101            if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
1102                choice = SchemaSymbols.EXTENSION|SchemaSymbols.RESTRICTION;
1103            } else {
1104                StringTokenizer JavaDoc t = new StringTokenizer JavaDoc (value, " ");
1105                while (t.hasMoreTokens()) {
1106                    String JavaDoc token = t.nextToken ();
1107
1108                    if (token.equals (SchemaSymbols.ATTVAL_EXTENSION)) {
1109                        choice |= SchemaSymbols.EXTENSION;
1110                    } else if (token.equals (SchemaSymbols.ATTVAL_RESTRICTION)) {
1111                        choice |= SchemaSymbols.RESTRICTION;
1112                    } else {
1113                        throw new InvalidDatatypeValueException("the value '"+value+"' must match (#all | List of (extension | restriction))");
1114                    }
1115                }
1116            }
1117//??? value = Integer.toString(choice);
1118
break;
1119        case DT_FINAL1:
1120            // final = (#all | (list | union | restriction))
1121
choice = 0;
1122            if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
1123                choice = SchemaSymbols.RESTRICTION|SchemaSymbols.LIST|
1124                         SchemaSymbols.UNION;
1125            } else if (value.equals (SchemaSymbols.ELT_LIST)) {
1126                choice = SchemaSymbols.LIST;
1127            } else if (value.equals (SchemaSymbols.ELT_UNION)) {
1128                choice = SchemaSymbols.UNION;
1129            } else if (value.equals (SchemaSymbols.ATTVAL_RESTRICTION)) {
1130                choice = SchemaSymbols.RESTRICTION;
1131            } else {
1132                throw new InvalidDatatypeValueException("the value '"+value+"' must match (#all | (list | union | restriction))");
1133            }
1134//??? value = Integer.toString(choice);
1135
break;
1136        case DT_FORM:
1137            // form = (qualified | unqualified)
1138
if (!value.equals (SchemaSymbols.ATTVAL_QUALIFIED) &&
1139                !value.equals (SchemaSymbols.ATTVAL_UNQUALIFIED)) {
1140                throw new InvalidDatatypeValueException("the value '"+value+"' must match (qualified | unqualified)");
1141            }
1142            break;
1143        case DT_MAXOCCURS:
1144            // maxOccurs = (nonNegativeInteger | unbounded)
1145
if (!value.equals("unbounded")) {
1146                try {
1147                    fExtraDVs[DT_NONNEGINT].validate(value, null);
1148                } catch (InvalidDatatypeValueException ide) {
1149                    throw new InvalidDatatypeValueException("the value '"+value+"' must match (nonNegativeInteger | unbounded)");
1150                }
1151            }
1152            break;
1153        case DT_MAXOCCURS1:
1154            // maxOccurs = 1
1155
if (!value.equals("1"))
1156                throw new InvalidDatatypeValueException("the value '"+value+"' must be '1'");
1157            break;
1158        case DT_MEMBERTYPES:
1159            // memberTypes = List of QName
1160
try {
1161                StringTokenizer JavaDoc t = new StringTokenizer JavaDoc (value, " ");
1162                while (t.hasMoreTokens()) {
1163                    String JavaDoc token = t.nextToken ();
1164                    fExtraDVs[DT_QNAME].validate(token, null);
1165                }
1166            } catch (InvalidDatatypeValueException ide) {
1167                throw new InvalidDatatypeValueException("the value '"+value+"' must match (List of QName)");
1168            }
1169            break;
1170        case DT_MINOCCURS1:
1171            // minOccurs = (0 | 1)
1172
if (!value.equals("0") && !value.equals("1"))
1173                throw new InvalidDatatypeValueException("the value '"+value+"' must be '0' or '1'");
1174            break;
1175        case DT_NAMESPACE:
1176            // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )
1177
if (!value.equals(SchemaSymbols.ATTVAL_TWOPOUNDANY) &&
1178                !value.equals(SchemaSymbols.ATTVAL_TWOPOUNDOTHER)) {
1179                StringTokenizer JavaDoc t = new StringTokenizer JavaDoc (value, " ");
1180                try {
1181                    while (t.hasMoreTokens()) {
1182                        String JavaDoc token = t.nextToken ();
1183                        if (!token.equals(SchemaSymbols.ATTVAL_TWOPOUNDTARGETNS) &&
1184                            !token.equals(SchemaSymbols.ATTVAL_TWOPOUNDLOCAL)) {
1185                            fExtraDVs[DT_ANYURI].validate(token, null);
1186                        }
1187                    }
1188                } catch (InvalidDatatypeValueException ide) {
1189                    throw new InvalidDatatypeValueException("the value '"+value+"' must match ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )");
1190                }
1191            }
1192            break;
1193        case DT_PROCESSCONTENTS:
1194            // processContents = (lax | skip | strict)
1195
if (!value.equals (SchemaSymbols.ATTVAL_SKIP) &&
1196                !value.equals (SchemaSymbols.ATTVAL_LAX) &&
1197                !value.equals (SchemaSymbols.ATTVAL_STRICT)) {
1198                throw new InvalidDatatypeValueException("the value '"+value+"' must match (lax | skip | strict)");
1199            }
1200            break;
1201        case DT_PUBLIC:
1202            // public = A public identifier, per ISO 8879 ???
1203
fExtraDVs[DT_TOKEN].validate(value, null);
1204            break;
1205        case DT_USE:
1206            // use = (optional | prohibited | required)
1207
if (!value.equals (SchemaSymbols.ATTVAL_OPTIONAL) &&
1208                !value.equals (SchemaSymbols.ATTVAL_PROHIBITED) &&
1209                !value.equals (SchemaSymbols.ATTVAL_REQUIRED)) {
1210                throw new InvalidDatatypeValueException("the value '"+value+"' must match (optional | prohibited | required)");
1211            }
1212            break;
1213        case DT_WHITESPACE:
1214            // value = preserve | replace | collapse
1215
if (!value.equals (SchemaSymbols.ATT_PRESERVE) &&
1216                !value.equals (SchemaSymbols.ATT_REPLACE) &&
1217                !value.equals (SchemaSymbols.ATT_COLLAPSE)) {
1218                throw new InvalidDatatypeValueException("the value '"+value+"' must match (preserve | replace | collapse)");
1219            }
1220            break;
1221        }
1222
1223        return value;
1224    }
1225
1226    // report an error. copied from TraverseSchema
1227
private void reportSchemaError(int major, Object JavaDoc args[]) throws Exception JavaDoc {
1228        if (fErrorReporter == null) {
1229            System.out.println("__TraverseSchemaError__ : " + SchemaMessageProvider.fgMessageKeys[major]);
1230            for (int i=0; i< args.length ; i++) {
1231                System.out.println((String JavaDoc)args[i]);
1232            }
1233        }
1234        else {
1235            fErrorReporter.reportError(fErrorReporter.getLocator(),
1236                                       SchemaMessageProvider.SCHEMA_DOMAIN,
1237                                       major,
1238                                       SchemaMessageProvider.MSG_NONE,
1239                                       args,
1240                                       XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR);
1241        }
1242    }
1243
1244    // validate attriubtes from non-schema namespaces
1245
public void checkNonSchemaAttributes(GrammarResolver grammarResolver) throws Exception JavaDoc {
1246        // for all attributes
1247
Enumeration JavaDoc enumer = fNonSchemaAttrs.keys();
1248        while (enumer.hasMoreElements()) {
1249            // get name, uri, localpart
1250
String JavaDoc attrRName = (String JavaDoc)enumer.nextElement();
1251            String JavaDoc attrURI = attrRName.substring(0,attrRName.indexOf(','));
1252            String JavaDoc attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
1253            // find associated grammar
1254
Grammar grammar = grammarResolver.getGrammar(attrURI);
1255            if (grammar == null || !(grammar instanceof SchemaGrammar))
1256                continue;
1257            SchemaGrammar sGrammar = (SchemaGrammar)grammar;
1258            // then get all top-level attributes from that grammar
1259
Hashtable JavaDoc attrRegistry = sGrammar.getAttributeDeclRegistry();
1260            if (attrRegistry == null)
1261                continue;
1262            // and get the datatype validator, if there is one
1263
XMLAttributeDecl tempAttrDecl = (XMLAttributeDecl)attrRegistry.get(attrLocal);
1264            if (tempAttrDecl == null)
1265                continue;
1266            DatatypeValidator dv = tempAttrDecl.datatypeValidator;
1267            if (dv == null)
1268                continue;
1269
1270            // get all values appeared with this attribute name
1271
Vector JavaDoc values = (Vector JavaDoc)fNonSchemaAttrs.get(attrRName);
1272            String JavaDoc elName, attrVal;
1273            String JavaDoc attrName = (String JavaDoc)values.elementAt(0);
1274            // for each of the values
1275
int count = values.size();
1276            for (int i = 1; i < count; i += 2) {
1277                // normalize it according to the whiteSpace facet
1278
elName = (String JavaDoc)values.elementAt(i);
1279                attrVal = normalize((String JavaDoc)values.elementAt(i+1), dv.getWSFacet());
1280                try {
1281                    // and validate it using the DatatypeValidator
1282
dv.validate(attrVal,null);
1283                } catch(InvalidDatatypeValueException ide) {
1284                    reportSchemaError (SchemaMessageProvider.Con3X3AttributeInvalidValue,
1285                                       new Object JavaDoc[] {elName, attrName, ide.getLocalizedMessage()});
1286                }
1287            }
1288        }
1289    }
1290
1291    // normalize the string according to the whiteSpace facet
1292
private String JavaDoc normalize(String JavaDoc content, short ws) {
1293        int len = content == null ? 0 : content.length();
1294        if (len == 0 || ws == DatatypeValidator.PRESERVE)
1295            return content;
1296
1297        StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
1298        if (ws == DatatypeValidator.REPLACE) {
1299            char ch;
1300            // when it's replace, just replace #x9, #xa, #xd by #x20
1301
for (int i = 0; i < len; i++) {
1302                ch = content.charAt(i);
1303                if (ch != 0x9 && ch != 0xa && ch != 0xd)
1304                    sb.append(ch);
1305                else
1306                    sb.append((char)0x20);
1307            }
1308        } else {
1309            char ch;
1310            int i;
1311            boolean isLeading = true;
1312            // when it's collapse
1313
for (i = 0; i < len; i++) {
1314                ch = content.charAt(i);
1315                // append real characters, so we passed leading ws
1316
if (ch != 0x9 && ch != 0xa && ch != 0xd && ch != 0x20) {
1317                    sb.append(ch);
1318                    isLeading = false;
1319                } else {
1320                    // for whitespaces, we skip all following ws
1321
for (; i < len-1; i++) {
1322                        ch = content.charAt(i+1);
1323                        if (ch != 0x9 && ch != 0xa && ch != 0xd && ch != 0x20)
1324                            break;
1325                    }
1326                    // if it's not a leading or tailing ws, then append a space
1327
if (i < len - 1 && !isLeading)
1328                        sb.append((char)0x20);
1329                }
1330            }
1331        }
1332
1333        return sb.toString();
1334    }
1335}
1336
1337class OneAttr {
1338    // name of the attribute
1339
public String JavaDoc name;
1340    // index of the datatype validator
1341
public int dvIndex;
1342    // whether it's optional, and has default value
1343
public int optdflt;
1344    // the default value of this attribute
1345
public String JavaDoc dfltValue;
1346
1347    public OneAttr(String JavaDoc name, int dvIndex, int optdflt, String JavaDoc dfltValue) {
1348        this.name = name;
1349        this.dvIndex = dvIndex;
1350        this.optdflt = optdflt;
1351        this.dfltValue = dfltValue;
1352    }
1353}
1354
1355class OneElement {
1356    // the list of attributes that can appear in one element
1357
public Hashtable JavaDoc attrList;
1358    // the array of attributes that can appear in one element
1359
public Object JavaDoc[] attrArray;
1360    // does this element allow attributes from non-schema namespace
1361
public boolean allowNonSchemaAttr;
1362
1363    public OneElement (Hashtable JavaDoc attrList) {
1364        this(attrList, true);
1365    }
1366
1367    public OneElement (Hashtable JavaDoc attrList, boolean allowNonSchemaAttr) {
1368        this.attrList = attrList;
1369
1370        int count = attrList.size();
1371        this.attrArray = new Object JavaDoc[count];
1372        Enumeration JavaDoc enumer = attrList.elements();
1373        for (int i = 0; i < count; i++)
1374            this.attrArray[i] = enumer.nextElement();
1375
1376        this.allowNonSchemaAttr = allowNonSchemaAttr;
1377    }
1378}
1379
Popular Tags