jaxp/src/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java
author tbell
Mon, 20 Apr 2009 22:50:16 -0700
changeset 2669 15024792697e
parent 6 7f561c08de6b
permissions -rw-r--r--
6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7 6573268: Four JCK-devtools-6a tests report OOM: Java Heap space since JDK7 b14 Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * Copyright 2001-2004 The Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xerces.internal.impl.xs.traversers;
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
import java.util.Enumeration;
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
import java.util.Hashtable;
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
import java.util.StringTokenizer;
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import java.util.Vector;
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar;
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport;
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols;
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
import com.sun.org.apache.xerces.internal.impl.xs.XSAttributeDecl;
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
import com.sun.org.apache.xerces.internal.impl.xs.XSGrammarBucket;
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
import com.sun.org.apache.xerces.internal.impl.xs.XSWildcardDecl;
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
import com.sun.org.apache.xerces.internal.impl.xs.util.XInt;
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
import com.sun.org.apache.xerces.internal.impl.xs.util.XIntPool;
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
import com.sun.org.apache.xerces.internal.util.DOMUtil;
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
import com.sun.org.apache.xerces.internal.util.SymbolTable;
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
import com.sun.org.apache.xerces.internal.xni.QName;
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
import com.sun.org.apache.xerces.internal.xs.XSConstants;
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
import org.w3c.dom.Attr;
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
import org.w3c.dom.Element;
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * Class <code>XSAttributeCheck</code> is used to check the validity of attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * appearing in the schema document. It
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * - reports an error for invalid element (invalid namespace, invalid name)
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * - reports an error for invalid attribute (invalid namespace, invalid name)
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * - reports an error for invalid attribute value
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * - return compiled values for attriute values
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * - provide default value for missing optional attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 * - provide default value for incorrect attribute values
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 * But it's the caller's responsibility to check whether a required attribute
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 * is present.
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 * Things need revisiting:
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
 * - Whether to return non-schema attributes/values
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
 * - Do we need to update NamespaceScope and ErrorReporter when reset()?
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
 * - Should have the datatype validators return compiled value
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
 * - use symbol table instead of many hashtables
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
 * @xerces.internal
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
 * @author Sandy Gao, IBM
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
public class XSAttributeChecker {
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
    // REVISIT: only local element and attribute are different from others.
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
    //          it's possible to have either name or ref. all the others
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
    //          are only allowed to have one of name or ref, or neither of them.
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
    //          we'd better move such checking to the traverser.
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
    private static final String ELEMENT_N = "element_n";
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
    private static final String ELEMENT_R = "element_r";
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
    private static final String ATTRIBUTE_N = "attribute_n";
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
    private static final String ATTRIBUTE_R = "attribute_r";
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
    private static       int ATTIDX_COUNT           = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
    public static final int ATTIDX_ABSTRACT        = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
    public static final int ATTIDX_AFORMDEFAULT    = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
    public static final int ATTIDX_BASE            = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
    public static final int ATTIDX_BLOCK           = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    public static final int ATTIDX_BLOCKDEFAULT    = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
    public static final int ATTIDX_DEFAULT         = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    public static final int ATTIDX_EFORMDEFAULT    = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
    public static final int ATTIDX_FINAL           = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
    public static final int ATTIDX_FINALDEFAULT    = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
    public static final int ATTIDX_FIXED           = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
    public static final int ATTIDX_FORM            = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
    public static final int ATTIDX_ID              = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
    public static final int ATTIDX_ITEMTYPE        = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
    public static final int ATTIDX_MAXOCCURS       = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
    public static final int ATTIDX_MEMBERTYPES     = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
    public static final int ATTIDX_MINOCCURS       = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
    public static final int ATTIDX_MIXED           = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
    public static final int ATTIDX_NAME            = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
    public static final int ATTIDX_NAMESPACE       = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
    public static final int ATTIDX_NAMESPACE_LIST  = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
    public static final int ATTIDX_NILLABLE        = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
    public static final int ATTIDX_NONSCHEMA       = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
    public static final int ATTIDX_PROCESSCONTENTS = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
    public static final int ATTIDX_PUBLIC          = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    public static final int ATTIDX_REF             = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
    public static final int ATTIDX_REFER           = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
    public static final int ATTIDX_SCHEMALOCATION  = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
    public static final int ATTIDX_SOURCE          = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
    public static final int ATTIDX_SUBSGROUP       = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
    public static final int ATTIDX_SYSTEM          = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
    public static final int ATTIDX_TARGETNAMESPACE = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
    public static final int ATTIDX_TYPE            = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
    public static final int ATTIDX_USE             = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
    public static final int ATTIDX_VALUE           = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
    public static final int ATTIDX_ENUMNSDECLS     = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
    public static final int ATTIDX_VERSION         = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
    public static final int ATTIDX_XML_LANG        = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
    public static final int ATTIDX_XPATH           = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
    public static final int ATTIDX_FROMDEFAULT     = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
    //public static final int ATTIDX_OTHERVALUES     = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
    public static final int ATTIDX_ISRETURNED      = ATTIDX_COUNT++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
    private static final XIntPool fXIntPool = new XIntPool();
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
    // constants to return
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
    private static final XInt INT_QUALIFIED      = fXIntPool.getXInt(SchemaSymbols.FORM_QUALIFIED);
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
    private static final XInt INT_UNQUALIFIED    = fXIntPool.getXInt(SchemaSymbols.FORM_UNQUALIFIED);
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
    private static final XInt INT_EMPTY_SET      = fXIntPool.getXInt(XSConstants.DERIVATION_NONE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
    private static final XInt INT_ANY_STRICT     = fXIntPool.getXInt(XSWildcardDecl.PC_STRICT);
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
    private static final XInt INT_ANY_LAX        = fXIntPool.getXInt(XSWildcardDecl.PC_LAX);
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
    private static final XInt INT_ANY_SKIP       = fXIntPool.getXInt(XSWildcardDecl.PC_SKIP);
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
    private static final XInt INT_ANY_ANY        = fXIntPool.getXInt(XSWildcardDecl.NSCONSTRAINT_ANY);
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
    private static final XInt INT_ANY_LIST       = fXIntPool.getXInt(XSWildcardDecl.NSCONSTRAINT_LIST);
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
    private static final XInt INT_ANY_NOT        = fXIntPool.getXInt(XSWildcardDecl.NSCONSTRAINT_NOT);
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
    private static final XInt INT_USE_OPTIONAL   = fXIntPool.getXInt(SchemaSymbols.USE_OPTIONAL);
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
    private static final XInt INT_USE_REQUIRED   = fXIntPool.getXInt(SchemaSymbols.USE_REQUIRED);
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
    private static final XInt INT_USE_PROHIBITED = fXIntPool.getXInt(SchemaSymbols.USE_PROHIBITED);
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
    private static final XInt INT_WS_PRESERVE    = fXIntPool.getXInt(XSSimpleType.WS_PRESERVE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
    private static final XInt INT_WS_REPLACE     = fXIntPool.getXInt(XSSimpleType.WS_REPLACE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
    private static final XInt INT_WS_COLLAPSE    = fXIntPool.getXInt(XSSimpleType.WS_COLLAPSE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
    private static final XInt INT_UNBOUNDED      = fXIntPool.getXInt(SchemaSymbols.OCCURRENCE_UNBOUNDED);
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
    // used to store the map from element name to attribute list
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
    // for 14 global elements
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
    private static final Hashtable fEleAttrsMapG = new Hashtable(29);
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
    // for 39 local elememnts
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
    private static final Hashtable fEleAttrsMapL = new Hashtable(79);
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
    // used to initialize fEleAttrsMap
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
    // step 1: all possible data types
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
    // DT_??? >= 0 : validate using a validator, which is initialized staticly
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
    // DT_??? <  0 : validate directly, which is done in "validate()"
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    protected static final int DT_ANYURI           = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
    protected static final int DT_ID               = 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
    protected static final int DT_QNAME            = 2;
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
    protected static final int DT_STRING           = 3;
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
    protected static final int DT_TOKEN            = 4;
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
    protected static final int DT_NCNAME           = 5;
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
    protected static final int DT_XPATH            = 6;
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
    protected static final int DT_XPATH1           = 7;
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
    protected static final int DT_LANGUAGE         = 8;
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
    // used to store extra datatype validators
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
    protected static final int DT_COUNT            = DT_LANGUAGE + 1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
    private static final XSSimpleType[] fExtraDVs = new XSSimpleType[DT_COUNT];
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
    static {
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
        // step 5: register all datatype validators for new types
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
        SchemaGrammar grammar = SchemaGrammar.SG_SchemaNS;
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
        // anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
        fExtraDVs[DT_ANYURI] = (XSSimpleType)grammar.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYURI);
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
        // ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
        fExtraDVs[DT_ID] = (XSSimpleType)grammar.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ID);
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
        // QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
        fExtraDVs[DT_QNAME] = (XSSimpleType)grammar.getGlobalTypeDecl(SchemaSymbols.ATTVAL_QNAME);
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
        // string
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
        fExtraDVs[DT_STRING] = (XSSimpleType)grammar.getGlobalTypeDecl(SchemaSymbols.ATTVAL_STRING);
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
        // token
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
        fExtraDVs[DT_TOKEN] = (XSSimpleType)grammar.getGlobalTypeDecl(SchemaSymbols.ATTVAL_TOKEN);
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
        // NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
        fExtraDVs[DT_NCNAME] = (XSSimpleType)grammar.getGlobalTypeDecl(SchemaSymbols.ATTVAL_NCNAME);
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
        // xpath = a subset of XPath expression
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
        fExtraDVs[DT_XPATH] = fExtraDVs[DT_STRING];
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
        // xpath = a subset of XPath expression
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
        fExtraDVs[DT_XPATH] = fExtraDVs[DT_STRING];
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
        // language
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
        fExtraDVs[DT_LANGUAGE] = (XSSimpleType)grammar.getGlobalTypeDecl(SchemaSymbols.ATTVAL_LANGUAGE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
    protected static final int DT_BLOCK            = -1;
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
    protected static final int DT_BLOCK1           = -2;
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
    protected static final int DT_FINAL            = -3;
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
    protected static final int DT_FINAL1           = -4;
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
    protected static final int DT_FINAL2           = -5;
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
    protected static final int DT_FORM             = -6;
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
    protected static final int DT_MAXOCCURS        = -7;
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
    protected static final int DT_MAXOCCURS1       = -8;
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
    protected static final int DT_MEMBERTYPES      = -9;
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
    protected static final int DT_MINOCCURS1       = -10;
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
    protected static final int DT_NAMESPACE        = -11;
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
    protected static final int DT_PROCESSCONTENTS  = -12;
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
    protected static final int DT_USE              = -13;
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
    protected static final int DT_WHITESPACE       = -14;
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
    protected static final int DT_BOOLEAN          = -15;
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
    protected static final int DT_NONNEGINT        = -16;
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
    protected static final int DT_POSINT           = -17;
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
    static {
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
        // step 2: all possible attributes for all elements
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
        int attCount = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
        int ATT_ABSTRACT_D          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
        int ATT_ATTRIBUTE_FD_D      = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
        int ATT_BASE_R              = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
        int ATT_BASE_N              = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
        int ATT_BLOCK_N             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
        int ATT_BLOCK1_N            = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
        int ATT_BLOCK_D_D           = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
        int ATT_DEFAULT_N           = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
        int ATT_ELEMENT_FD_D        = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
        int ATT_FINAL_N             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
        int ATT_FINAL1_N            = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
        int ATT_FINAL_D_D           = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
        int ATT_FIXED_N             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
        int ATT_FIXED_D             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
        int ATT_FORM_N              = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
        int ATT_ID_N                = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
        int ATT_ITEMTYPE_N          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
        int ATT_MAXOCCURS_D         = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
        int ATT_MAXOCCURS1_D        = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
        int ATT_MEMBER_T_N          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
        int ATT_MINOCCURS_D         = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
        int ATT_MINOCCURS1_D        = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
        int ATT_MIXED_D             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
        int ATT_MIXED_N             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
        int ATT_NAME_R              = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
        int ATT_NAMESPACE_D         = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
        int ATT_NAMESPACE_N         = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
        int ATT_NILLABLE_D          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
        int ATT_PROCESS_C_D         = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
        int ATT_PUBLIC_R            = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
        int ATT_REF_R               = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
        int ATT_REFER_R             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
        int ATT_SCHEMA_L_R          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
        int ATT_SCHEMA_L_N          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
        int ATT_SOURCE_N            = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
        int ATT_SUBSTITUTION_G_N    = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
        int ATT_SYSTEM_N            = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
        int ATT_TARGET_N_N          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
        int ATT_TYPE_N              = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
        int ATT_USE_D               = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
        int ATT_VALUE_NNI_N         = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
        int ATT_VALUE_PI_N          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
        int ATT_VALUE_STR_N         = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
        int ATT_VALUE_WS_N          = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
        int ATT_VERSION_N           = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
        int ATT_XML_LANG            = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
        int ATT_XPATH_R             = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
        int ATT_XPATH1_R            = attCount++;
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
        // step 3: store all these attributes in an array
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
        OneAttr[] allAttrs = new OneAttr[attCount];
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
        allAttrs[ATT_ABSTRACT_D]        =   new OneAttr(SchemaSymbols.ATT_ABSTRACT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
                                                        DT_BOOLEAN,
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
                                                        ATTIDX_ABSTRACT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
                                                        Boolean.FALSE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
        allAttrs[ATT_ATTRIBUTE_FD_D]    =   new OneAttr(SchemaSymbols.ATT_ATTRIBUTEFORMDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
                                                        DT_FORM,
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
                                                        ATTIDX_AFORMDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
                                                        INT_UNQUALIFIED);
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
        allAttrs[ATT_BASE_R]            =   new OneAttr(SchemaSymbols.ATT_BASE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
                                                        DT_QNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
                                                        ATTIDX_BASE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
        allAttrs[ATT_BASE_N]            =   new OneAttr(SchemaSymbols.ATT_BASE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
                                                        DT_QNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
                                                        ATTIDX_BASE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
        allAttrs[ATT_BLOCK_N]           =   new OneAttr(SchemaSymbols.ATT_BLOCK,
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
                                                        DT_BLOCK,
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
                                                        ATTIDX_BLOCK,
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
        allAttrs[ATT_BLOCK1_N]          =   new OneAttr(SchemaSymbols.ATT_BLOCK,
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
                                                        DT_BLOCK1,
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
                                                        ATTIDX_BLOCK,
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
        allAttrs[ATT_BLOCK_D_D]         =   new OneAttr(SchemaSymbols.ATT_BLOCKDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
                                                        DT_BLOCK,
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
                                                        ATTIDX_BLOCKDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
                                                        INT_EMPTY_SET);
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
        allAttrs[ATT_DEFAULT_N]         =   new OneAttr(SchemaSymbols.ATT_DEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
                                                        DT_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
                                                        ATTIDX_DEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
        allAttrs[ATT_ELEMENT_FD_D]      =   new OneAttr(SchemaSymbols.ATT_ELEMENTFORMDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
                                                        DT_FORM,
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
                                                        ATTIDX_EFORMDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
                                                        INT_UNQUALIFIED);
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
        allAttrs[ATT_FINAL_N]           =   new OneAttr(SchemaSymbols.ATT_FINAL,
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
                                                        DT_FINAL,
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
                                                        ATTIDX_FINAL,
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
        allAttrs[ATT_FINAL1_N]          =   new OneAttr(SchemaSymbols.ATT_FINAL,
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
                                                        DT_FINAL1,
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
                                                        ATTIDX_FINAL,
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
        allAttrs[ATT_FINAL_D_D]         =   new OneAttr(SchemaSymbols.ATT_FINALDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
                                                        DT_FINAL2,
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
                                                        ATTIDX_FINALDEFAULT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
                                                        INT_EMPTY_SET);
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
        allAttrs[ATT_FIXED_N]           =   new OneAttr(SchemaSymbols.ATT_FIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
                                                        DT_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
                                                        ATTIDX_FIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
        allAttrs[ATT_FIXED_D]           =   new OneAttr(SchemaSymbols.ATT_FIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
                                                        DT_BOOLEAN,
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
                                                        ATTIDX_FIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
                                                        Boolean.FALSE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
        allAttrs[ATT_FORM_N]            =   new OneAttr(SchemaSymbols.ATT_FORM,
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
                                                        DT_FORM,
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
                                                        ATTIDX_FORM,
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
        allAttrs[ATT_ID_N]              =   new OneAttr(SchemaSymbols.ATT_ID,
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
                                                        DT_ID,
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
                                                        ATTIDX_ID,
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
        allAttrs[ATT_ITEMTYPE_N]        =   new OneAttr(SchemaSymbols.ATT_ITEMTYPE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
                                                        DT_QNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
                                                        ATTIDX_ITEMTYPE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
        allAttrs[ATT_MAXOCCURS_D]       =   new OneAttr(SchemaSymbols.ATT_MAXOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
                                                        DT_MAXOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
                                                        ATTIDX_MAXOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
                                                        fXIntPool.getXInt(1));
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
        allAttrs[ATT_MAXOCCURS1_D]      =   new OneAttr(SchemaSymbols.ATT_MAXOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
                                                        DT_MAXOCCURS1,
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
                                                        ATTIDX_MAXOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
                                                        fXIntPool.getXInt(1));
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
        allAttrs[ATT_MEMBER_T_N]        =   new OneAttr(SchemaSymbols.ATT_MEMBERTYPES,
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
                                                        DT_MEMBERTYPES,
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
                                                        ATTIDX_MEMBERTYPES,
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
        allAttrs[ATT_MINOCCURS_D]       =   new OneAttr(SchemaSymbols.ATT_MINOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
                                                        DT_NONNEGINT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
                                                        ATTIDX_MINOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
                                                        fXIntPool.getXInt(1));
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
        allAttrs[ATT_MINOCCURS1_D]      =   new OneAttr(SchemaSymbols.ATT_MINOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
                                                        DT_MINOCCURS1,
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
                                                        ATTIDX_MINOCCURS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
                                                        fXIntPool.getXInt(1));
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
        allAttrs[ATT_MIXED_D]           =   new OneAttr(SchemaSymbols.ATT_MIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
                                                        DT_BOOLEAN,
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
                                                        ATTIDX_MIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   353
                                                        Boolean.FALSE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
        allAttrs[ATT_MIXED_N]           =   new OneAttr(SchemaSymbols.ATT_MIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
                                                        DT_BOOLEAN,
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
                                                        ATTIDX_MIXED,
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
        allAttrs[ATT_NAME_R]            =   new OneAttr(SchemaSymbols.ATT_NAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
                                                        DT_NCNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
                                                        ATTIDX_NAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   362
        allAttrs[ATT_NAMESPACE_D]       =   new OneAttr(SchemaSymbols.ATT_NAMESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
                                                        DT_NAMESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
                                                        ATTIDX_NAMESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
                                                        INT_ANY_ANY);
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
        allAttrs[ATT_NAMESPACE_N]       =   new OneAttr(SchemaSymbols.ATT_NAMESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   367
                                                        DT_ANYURI,
7f561c08de6b Initial load
duke
parents:
diff changeset
   368
                                                        ATTIDX_NAMESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   369
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   370
        allAttrs[ATT_NILLABLE_D]        =   new OneAttr(SchemaSymbols.ATT_NILLABLE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   371
                                                        DT_BOOLEAN,
7f561c08de6b Initial load
duke
parents:
diff changeset
   372
                                                        ATTIDX_NILLABLE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   373
                                                        Boolean.FALSE);
7f561c08de6b Initial load
duke
parents:
diff changeset
   374
        allAttrs[ATT_PROCESS_C_D]       =   new OneAttr(SchemaSymbols.ATT_PROCESSCONTENTS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   375
                                                        DT_PROCESSCONTENTS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   376
                                                        ATTIDX_PROCESSCONTENTS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   377
                                                        INT_ANY_STRICT);
7f561c08de6b Initial load
duke
parents:
diff changeset
   378
        allAttrs[ATT_PUBLIC_R]          =   new OneAttr(SchemaSymbols.ATT_PUBLIC,
7f561c08de6b Initial load
duke
parents:
diff changeset
   379
                                                        DT_TOKEN,
7f561c08de6b Initial load
duke
parents:
diff changeset
   380
                                                        ATTIDX_PUBLIC,
7f561c08de6b Initial load
duke
parents:
diff changeset
   381
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   382
        allAttrs[ATT_REF_R]             =   new OneAttr(SchemaSymbols.ATT_REF,
7f561c08de6b Initial load
duke
parents:
diff changeset
   383
                                                        DT_QNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   384
                                                        ATTIDX_REF,
7f561c08de6b Initial load
duke
parents:
diff changeset
   385
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   386
        allAttrs[ATT_REFER_R]           =   new OneAttr(SchemaSymbols.ATT_REFER,
7f561c08de6b Initial load
duke
parents:
diff changeset
   387
                                                        DT_QNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   388
                                                        ATTIDX_REFER,
7f561c08de6b Initial load
duke
parents:
diff changeset
   389
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   390
        allAttrs[ATT_SCHEMA_L_R]        =   new OneAttr(SchemaSymbols.ATT_SCHEMALOCATION,
7f561c08de6b Initial load
duke
parents:
diff changeset
   391
                                                        DT_ANYURI,
7f561c08de6b Initial load
duke
parents:
diff changeset
   392
                                                        ATTIDX_SCHEMALOCATION,
7f561c08de6b Initial load
duke
parents:
diff changeset
   393
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   394
        allAttrs[ATT_SCHEMA_L_N]        =   new OneAttr(SchemaSymbols.ATT_SCHEMALOCATION,
7f561c08de6b Initial load
duke
parents:
diff changeset
   395
                                                        DT_ANYURI,
7f561c08de6b Initial load
duke
parents:
diff changeset
   396
                                                        ATTIDX_SCHEMALOCATION,
7f561c08de6b Initial load
duke
parents:
diff changeset
   397
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   398
        allAttrs[ATT_SOURCE_N]          =   new OneAttr(SchemaSymbols.ATT_SOURCE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   399
                                                        DT_ANYURI,
7f561c08de6b Initial load
duke
parents:
diff changeset
   400
                                                        ATTIDX_SOURCE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   401
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   402
        allAttrs[ATT_SUBSTITUTION_G_N]  =   new OneAttr(SchemaSymbols.ATT_SUBSTITUTIONGROUP,
7f561c08de6b Initial load
duke
parents:
diff changeset
   403
                                                        DT_QNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   404
                                                        ATTIDX_SUBSGROUP,
7f561c08de6b Initial load
duke
parents:
diff changeset
   405
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   406
        allAttrs[ATT_SYSTEM_N]          =   new OneAttr(SchemaSymbols.ATT_SYSTEM,
7f561c08de6b Initial load
duke
parents:
diff changeset
   407
                                                        DT_ANYURI,
7f561c08de6b Initial load
duke
parents:
diff changeset
   408
                                                        ATTIDX_SYSTEM,
7f561c08de6b Initial load
duke
parents:
diff changeset
   409
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   410
        allAttrs[ATT_TARGET_N_N]        =   new OneAttr(SchemaSymbols.ATT_TARGETNAMESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   411
                                                        DT_ANYURI,
7f561c08de6b Initial load
duke
parents:
diff changeset
   412
                                                        ATTIDX_TARGETNAMESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   413
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   414
        allAttrs[ATT_TYPE_N]            =   new OneAttr(SchemaSymbols.ATT_TYPE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   415
                                                        DT_QNAME,
7f561c08de6b Initial load
duke
parents:
diff changeset
   416
                                                        ATTIDX_TYPE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   417
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   418
        allAttrs[ATT_USE_D]             =   new OneAttr(SchemaSymbols.ATT_USE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   419
                                                        DT_USE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   420
                                                        ATTIDX_USE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   421
                                                        INT_USE_OPTIONAL);
7f561c08de6b Initial load
duke
parents:
diff changeset
   422
        allAttrs[ATT_VALUE_NNI_N]       =   new OneAttr(SchemaSymbols.ATT_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   423
                                                        DT_NONNEGINT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   424
                                                        ATTIDX_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   425
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   426
        allAttrs[ATT_VALUE_PI_N]        =   new OneAttr(SchemaSymbols.ATT_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   427
                                                        DT_POSINT,
7f561c08de6b Initial load
duke
parents:
diff changeset
   428
                                                        ATTIDX_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   429
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   430
        allAttrs[ATT_VALUE_STR_N]       =   new OneAttr(SchemaSymbols.ATT_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   431
                                                        DT_STRING,
7f561c08de6b Initial load
duke
parents:
diff changeset
   432
                                                        ATTIDX_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   433
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   434
        allAttrs[ATT_VALUE_WS_N]        =   new OneAttr(SchemaSymbols.ATT_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   435
                                                        DT_WHITESPACE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   436
                                                        ATTIDX_VALUE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   437
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   438
        allAttrs[ATT_VERSION_N]         =   new OneAttr(SchemaSymbols.ATT_VERSION,
7f561c08de6b Initial load
duke
parents:
diff changeset
   439
                                                        DT_TOKEN,
7f561c08de6b Initial load
duke
parents:
diff changeset
   440
                                                        ATTIDX_VERSION,
7f561c08de6b Initial load
duke
parents:
diff changeset
   441
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   442
        allAttrs[ATT_XML_LANG]          =   new OneAttr(SchemaSymbols.ATT_XML_LANG,
7f561c08de6b Initial load
duke
parents:
diff changeset
   443
                                                        DT_LANGUAGE,
7f561c08de6b Initial load
duke
parents:
diff changeset
   444
                                                        ATTIDX_XML_LANG,
7f561c08de6b Initial load
duke
parents:
diff changeset
   445
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   446
        allAttrs[ATT_XPATH_R]           =   new OneAttr(SchemaSymbols.ATT_XPATH,
7f561c08de6b Initial load
duke
parents:
diff changeset
   447
                                                        DT_XPATH,
7f561c08de6b Initial load
duke
parents:
diff changeset
   448
                                                        ATTIDX_XPATH,
7f561c08de6b Initial load
duke
parents:
diff changeset
   449
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   450
        allAttrs[ATT_XPATH1_R]          =   new OneAttr(SchemaSymbols.ATT_XPATH,
7f561c08de6b Initial load
duke
parents:
diff changeset
   451
                                                        DT_XPATH1,
7f561c08de6b Initial load
duke
parents:
diff changeset
   452
                                                        ATTIDX_XPATH,
7f561c08de6b Initial load
duke
parents:
diff changeset
   453
                                                        null);
7f561c08de6b Initial load
duke
parents:
diff changeset
   454
7f561c08de6b Initial load
duke
parents:
diff changeset
   455
        // step 4: for each element, make a list of possible attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
   456
        Container attrList;
7f561c08de6b Initial load
duke
parents:
diff changeset
   457
        OneElement oneEle;
7f561c08de6b Initial load
duke
parents:
diff changeset
   458
7f561c08de6b Initial load
duke
parents:
diff changeset
   459
        // for element "attribute" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   460
        attrList = Container.getContainer(5);
7f561c08de6b Initial load
duke
parents:
diff changeset
   461
        // default = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   462
        attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   463
        // fixed = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   464
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   465
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   466
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   467
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   468
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   469
        // type = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   470
        attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   471
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   472
        fEleAttrsMapG.put(SchemaSymbols.ELT_ATTRIBUTE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   473
7f561c08de6b Initial load
duke
parents:
diff changeset
   474
        // for element "attribute" - local name
7f561c08de6b Initial load
duke
parents:
diff changeset
   475
        attrList = Container.getContainer(7);
7f561c08de6b Initial load
duke
parents:
diff changeset
   476
        // default = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   477
        attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   478
        // fixed = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   479
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   480
        // form = (qualified | unqualified)
7f561c08de6b Initial load
duke
parents:
diff changeset
   481
        attrList.put(SchemaSymbols.ATT_FORM, allAttrs[ATT_FORM_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   482
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   483
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   484
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   485
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   486
        // type = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   487
        attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   488
        // use = (optional | prohibited | required) : optional
7f561c08de6b Initial load
duke
parents:
diff changeset
   489
        attrList.put(SchemaSymbols.ATT_USE, allAttrs[ATT_USE_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   490
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   491
        fEleAttrsMapL.put(ATTRIBUTE_N, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   492
7f561c08de6b Initial load
duke
parents:
diff changeset
   493
        // for element "attribute" - local ref
7f561c08de6b Initial load
duke
parents:
diff changeset
   494
        attrList = Container.getContainer(5);
7f561c08de6b Initial load
duke
parents:
diff changeset
   495
        // default = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   496
        attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   497
        // fixed = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   498
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   499
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   500
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   501
        // ref = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   502
        attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   503
        // use = (optional | prohibited | required) : optional
7f561c08de6b Initial load
duke
parents:
diff changeset
   504
        attrList.put(SchemaSymbols.ATT_USE, allAttrs[ATT_USE_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   505
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   506
        fEleAttrsMapL.put(ATTRIBUTE_R, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   507
7f561c08de6b Initial load
duke
parents:
diff changeset
   508
        // for element "element" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   509
        attrList = Container.getContainer(10);
7f561c08de6b Initial load
duke
parents:
diff changeset
   510
        // abstract = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   511
        attrList.put(SchemaSymbols.ATT_ABSTRACT, allAttrs[ATT_ABSTRACT_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   512
        // block = (#all | List of (substitution | extension | restriction | list | union))
7f561c08de6b Initial load
duke
parents:
diff changeset
   513
        attrList.put(SchemaSymbols.ATT_BLOCK, allAttrs[ATT_BLOCK_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   514
        // default = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   515
        attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   516
        // final = (#all | List of (extension | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
   517
        attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   518
        // fixed = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   519
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   520
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   521
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   522
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   523
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   524
        // nillable = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   525
        attrList.put(SchemaSymbols.ATT_NILLABLE, allAttrs[ATT_NILLABLE_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   526
        // substitutionGroup = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   527
        attrList.put(SchemaSymbols.ATT_SUBSTITUTIONGROUP, allAttrs[ATT_SUBSTITUTION_G_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   528
        // type = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   529
        attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   530
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   531
        fEleAttrsMapG.put(SchemaSymbols.ELT_ELEMENT, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   532
7f561c08de6b Initial load
duke
parents:
diff changeset
   533
        // for element "element" - local name
7f561c08de6b Initial load
duke
parents:
diff changeset
   534
        attrList = Container.getContainer(10);
7f561c08de6b Initial load
duke
parents:
diff changeset
   535
        // block = (#all | List of (substitution | extension | restriction | list | union))
7f561c08de6b Initial load
duke
parents:
diff changeset
   536
        attrList.put(SchemaSymbols.ATT_BLOCK, allAttrs[ATT_BLOCK_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   537
        // default = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   538
        attrList.put(SchemaSymbols.ATT_DEFAULT, allAttrs[ATT_DEFAULT_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   539
        // fixed = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   540
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   541
        // form = (qualified | unqualified)
7f561c08de6b Initial load
duke
parents:
diff changeset
   542
        attrList.put(SchemaSymbols.ATT_FORM, allAttrs[ATT_FORM_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   543
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   544
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   545
        // maxOccurs = (nonNegativeInteger | unbounded)  : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   546
        attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   547
        // minOccurs = nonNegativeInteger : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   548
        attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   549
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   550
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   551
        // nillable = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   552
        attrList.put(SchemaSymbols.ATT_NILLABLE, allAttrs[ATT_NILLABLE_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   553
        // type = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   554
        attrList.put(SchemaSymbols.ATT_TYPE, allAttrs[ATT_TYPE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   555
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   556
        fEleAttrsMapL.put(ELEMENT_N, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   557
7f561c08de6b Initial load
duke
parents:
diff changeset
   558
        // for element "element" - local ref
7f561c08de6b Initial load
duke
parents:
diff changeset
   559
        attrList = Container.getContainer(4);
7f561c08de6b Initial load
duke
parents:
diff changeset
   560
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   561
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   562
        // maxOccurs = (nonNegativeInteger | unbounded)  : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   563
        attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   564
        // minOccurs = nonNegativeInteger : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   565
        attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   566
        // ref = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   567
        attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   568
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   569
        fEleAttrsMapL.put(ELEMENT_R, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   570
7f561c08de6b Initial load
duke
parents:
diff changeset
   571
        // for element "complexType" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   572
        attrList = Container.getContainer(6);
7f561c08de6b Initial load
duke
parents:
diff changeset
   573
        // abstract = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   574
        attrList.put(SchemaSymbols.ATT_ABSTRACT, allAttrs[ATT_ABSTRACT_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   575
        // block = (#all | List of (extension | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
   576
        attrList.put(SchemaSymbols.ATT_BLOCK, allAttrs[ATT_BLOCK1_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   577
        // final = (#all | List of (extension | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
   578
        attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   579
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   580
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   581
        // mixed = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   582
        attrList.put(SchemaSymbols.ATT_MIXED, allAttrs[ATT_MIXED_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   583
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   584
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   585
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   586
        fEleAttrsMapG.put(SchemaSymbols.ELT_COMPLEXTYPE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   587
7f561c08de6b Initial load
duke
parents:
diff changeset
   588
        // for element "notation" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   589
        attrList = Container.getContainer(4);
7f561c08de6b Initial load
duke
parents:
diff changeset
   590
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   591
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   592
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   593
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   594
        // public = A public identifier, per ISO 8879
7f561c08de6b Initial load
duke
parents:
diff changeset
   595
        attrList.put(SchemaSymbols.ATT_PUBLIC, allAttrs[ATT_PUBLIC_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   596
        // system = anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   597
        attrList.put(SchemaSymbols.ATT_SYSTEM, allAttrs[ATT_SYSTEM_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   598
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   599
        fEleAttrsMapG.put(SchemaSymbols.ELT_NOTATION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   600
7f561c08de6b Initial load
duke
parents:
diff changeset
   601
7f561c08de6b Initial load
duke
parents:
diff changeset
   602
        // for element "complexType" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   603
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   604
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   605
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   606
        // mixed = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   607
        attrList.put(SchemaSymbols.ATT_MIXED, allAttrs[ATT_MIXED_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   608
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   609
        fEleAttrsMapL.put(SchemaSymbols.ELT_COMPLEXTYPE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   610
7f561c08de6b Initial load
duke
parents:
diff changeset
   611
        // for element "simpleContent" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   612
        attrList = Container.getContainer(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
   613
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   614
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   615
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   616
        fEleAttrsMapL.put(SchemaSymbols.ELT_SIMPLECONTENT, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   617
7f561c08de6b Initial load
duke
parents:
diff changeset
   618
        // for element "restriction" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   619
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   620
        // base = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   621
        attrList.put(SchemaSymbols.ATT_BASE, allAttrs[ATT_BASE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   622
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   623
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   624
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   625
        fEleAttrsMapL.put(SchemaSymbols.ELT_RESTRICTION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   626
7f561c08de6b Initial load
duke
parents:
diff changeset
   627
        // for element "extension" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   628
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   629
        // base = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   630
        attrList.put(SchemaSymbols.ATT_BASE, allAttrs[ATT_BASE_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   631
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   632
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   633
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   634
        fEleAttrsMapL.put(SchemaSymbols.ELT_EXTENSION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   635
7f561c08de6b Initial load
duke
parents:
diff changeset
   636
        // for element "attributeGroup" - local ref
7f561c08de6b Initial load
duke
parents:
diff changeset
   637
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   638
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   639
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   640
        // ref = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   641
        attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   642
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   643
        fEleAttrsMapL.put(SchemaSymbols.ELT_ATTRIBUTEGROUP, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   644
7f561c08de6b Initial load
duke
parents:
diff changeset
   645
        // for element "anyAttribute" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   646
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   647
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   648
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   649
        // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
7f561c08de6b Initial load
duke
parents:
diff changeset
   650
        attrList.put(SchemaSymbols.ATT_NAMESPACE, allAttrs[ATT_NAMESPACE_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   651
        // processContents = (lax | skip | strict) : strict
7f561c08de6b Initial load
duke
parents:
diff changeset
   652
        attrList.put(SchemaSymbols.ATT_PROCESSCONTENTS, allAttrs[ATT_PROCESS_C_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   653
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   654
        fEleAttrsMapL.put(SchemaSymbols.ELT_ANYATTRIBUTE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   655
7f561c08de6b Initial load
duke
parents:
diff changeset
   656
        // for element "complexContent" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   657
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   658
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   659
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   660
        // mixed = boolean
7f561c08de6b Initial load
duke
parents:
diff changeset
   661
        attrList.put(SchemaSymbols.ATT_MIXED, allAttrs[ATT_MIXED_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   662
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   663
        fEleAttrsMapL.put(SchemaSymbols.ELT_COMPLEXCONTENT, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   664
7f561c08de6b Initial load
duke
parents:
diff changeset
   665
        // for element "attributeGroup" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   666
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   667
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   668
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   669
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   670
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   671
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   672
        fEleAttrsMapG.put(SchemaSymbols.ELT_ATTRIBUTEGROUP, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   673
7f561c08de6b Initial load
duke
parents:
diff changeset
   674
        // for element "group" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   675
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   676
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   677
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   678
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   679
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   680
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   681
        fEleAttrsMapG.put(SchemaSymbols.ELT_GROUP, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   682
7f561c08de6b Initial load
duke
parents:
diff changeset
   683
        // for element "group" - local ref
7f561c08de6b Initial load
duke
parents:
diff changeset
   684
        attrList = Container.getContainer(4);
7f561c08de6b Initial load
duke
parents:
diff changeset
   685
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   686
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   687
        // maxOccurs = (nonNegativeInteger | unbounded)  : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   688
        attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   689
        // minOccurs = nonNegativeInteger : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   690
        attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   691
        // ref = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   692
        attrList.put(SchemaSymbols.ATT_REF, allAttrs[ATT_REF_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   693
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   694
        fEleAttrsMapL.put(SchemaSymbols.ELT_GROUP, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   695
7f561c08de6b Initial load
duke
parents:
diff changeset
   696
        // for element "all" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   697
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   698
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   699
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   700
        // maxOccurs = 1 : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   701
        attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS1_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   702
        // minOccurs = (0 | 1) : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   703
        attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS1_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   704
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   705
        fEleAttrsMapL.put(SchemaSymbols.ELT_ALL, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   706
7f561c08de6b Initial load
duke
parents:
diff changeset
   707
        // for element "choice" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   708
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   709
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   710
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   711
        // maxOccurs = (nonNegativeInteger | unbounded)  : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   712
        attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   713
        // minOccurs = nonNegativeInteger : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   714
        attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   715
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   716
        fEleAttrsMapL.put(SchemaSymbols.ELT_CHOICE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   717
        // for element "sequence" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   718
        fEleAttrsMapL.put(SchemaSymbols.ELT_SEQUENCE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   719
7f561c08de6b Initial load
duke
parents:
diff changeset
   720
        // for element "any" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   721
        attrList = Container.getContainer(5);
7f561c08de6b Initial load
duke
parents:
diff changeset
   722
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   723
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   724
        // maxOccurs = (nonNegativeInteger | unbounded)  : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   725
        attrList.put(SchemaSymbols.ATT_MAXOCCURS, allAttrs[ATT_MAXOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   726
        // minOccurs = nonNegativeInteger : 1
7f561c08de6b Initial load
duke
parents:
diff changeset
   727
        attrList.put(SchemaSymbols.ATT_MINOCCURS, allAttrs[ATT_MINOCCURS_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   728
        // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
7f561c08de6b Initial load
duke
parents:
diff changeset
   729
        attrList.put(SchemaSymbols.ATT_NAMESPACE, allAttrs[ATT_NAMESPACE_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   730
        // processContents = (lax | skip | strict) : strict
7f561c08de6b Initial load
duke
parents:
diff changeset
   731
        attrList.put(SchemaSymbols.ATT_PROCESSCONTENTS, allAttrs[ATT_PROCESS_C_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   732
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   733
        fEleAttrsMapL.put(SchemaSymbols.ELT_ANY, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   734
7f561c08de6b Initial load
duke
parents:
diff changeset
   735
        // for element "unique" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   736
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   737
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   738
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   739
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   740
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   741
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   742
        fEleAttrsMapL.put(SchemaSymbols.ELT_UNIQUE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   743
        // for element "key" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   744
        fEleAttrsMapL.put(SchemaSymbols.ELT_KEY, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   745
7f561c08de6b Initial load
duke
parents:
diff changeset
   746
        // for element "keyref" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   747
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   748
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   749
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   750
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   751
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   752
        // refer = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   753
        attrList.put(SchemaSymbols.ATT_REFER, allAttrs[ATT_REFER_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   754
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   755
        fEleAttrsMapL.put(SchemaSymbols.ELT_KEYREF, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   756
7f561c08de6b Initial load
duke
parents:
diff changeset
   757
        // for element "selector" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   758
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   759
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   760
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   761
        // xpath = a subset of XPath expression
7f561c08de6b Initial load
duke
parents:
diff changeset
   762
        attrList.put(SchemaSymbols.ATT_XPATH, allAttrs[ATT_XPATH_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   763
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   764
        fEleAttrsMapL.put(SchemaSymbols.ELT_SELECTOR, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   765
7f561c08de6b Initial load
duke
parents:
diff changeset
   766
        // for element "field" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   767
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   768
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   769
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   770
        // xpath = a subset of XPath expression
7f561c08de6b Initial load
duke
parents:
diff changeset
   771
        attrList.put(SchemaSymbols.ATT_XPATH, allAttrs[ATT_XPATH1_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   772
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   773
        fEleAttrsMapL.put(SchemaSymbols.ELT_FIELD, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   774
7f561c08de6b Initial load
duke
parents:
diff changeset
   775
        // for element "annotation" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   776
        attrList = Container.getContainer(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
   777
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   778
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   779
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   780
        fEleAttrsMapG.put(SchemaSymbols.ELT_ANNOTATION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   781
        // for element "annotation" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   782
        fEleAttrsMapL.put(SchemaSymbols.ELT_ANNOTATION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   783
7f561c08de6b Initial load
duke
parents:
diff changeset
   784
        // for element "appinfo" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   785
        attrList = Container.getContainer(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
   786
        // source = anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   787
        attrList.put(SchemaSymbols.ATT_SOURCE, allAttrs[ATT_SOURCE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   788
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   789
        fEleAttrsMapG.put(SchemaSymbols.ELT_APPINFO, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   790
        fEleAttrsMapL.put(SchemaSymbols.ELT_APPINFO, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   791
7f561c08de6b Initial load
duke
parents:
diff changeset
   792
        // for element "documentation" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   793
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   794
        // source = anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   795
        attrList.put(SchemaSymbols.ATT_SOURCE, allAttrs[ATT_SOURCE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   796
        // xml:lang = language
7f561c08de6b Initial load
duke
parents:
diff changeset
   797
        attrList.put(SchemaSymbols.ATT_XML_LANG, allAttrs[ATT_XML_LANG]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   798
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   799
        fEleAttrsMapG.put(SchemaSymbols.ELT_DOCUMENTATION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   800
        fEleAttrsMapL.put(SchemaSymbols.ELT_DOCUMENTATION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   801
7f561c08de6b Initial load
duke
parents:
diff changeset
   802
        // for element "simpleType" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   803
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   804
        // final = (#all | List of (list | union | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
   805
        attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL1_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   806
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   807
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   808
        // name = NCName
7f561c08de6b Initial load
duke
parents:
diff changeset
   809
        attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   810
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   811
        fEleAttrsMapG.put(SchemaSymbols.ELT_SIMPLETYPE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   812
7f561c08de6b Initial load
duke
parents:
diff changeset
   813
        // for element "simpleType" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   814
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   815
        // final = (#all | List of (list | union | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
   816
        attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL1_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   817
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   818
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   819
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   820
        fEleAttrsMapL.put(SchemaSymbols.ELT_SIMPLETYPE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   821
7f561c08de6b Initial load
duke
parents:
diff changeset
   822
        // for element "restriction" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   823
        // already registered for complexType
7f561c08de6b Initial load
duke
parents:
diff changeset
   824
7f561c08de6b Initial load
duke
parents:
diff changeset
   825
        // for element "list" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   826
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   827
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   828
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   829
        // itemType = QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   830
        attrList.put(SchemaSymbols.ATT_ITEMTYPE, allAttrs[ATT_ITEMTYPE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   831
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   832
        fEleAttrsMapL.put(SchemaSymbols.ELT_LIST, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   833
7f561c08de6b Initial load
duke
parents:
diff changeset
   834
        // for element "union" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   835
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   836
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   837
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   838
        // memberTypes = List of QName
7f561c08de6b Initial load
duke
parents:
diff changeset
   839
        attrList.put(SchemaSymbols.ATT_MEMBERTYPES, allAttrs[ATT_MEMBER_T_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   840
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   841
        fEleAttrsMapL.put(SchemaSymbols.ELT_UNION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   842
7f561c08de6b Initial load
duke
parents:
diff changeset
   843
        // for element "schema" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   844
        attrList = Container.getContainer(8);
7f561c08de6b Initial load
duke
parents:
diff changeset
   845
        // attributeFormDefault = (qualified | unqualified) : unqualified
7f561c08de6b Initial load
duke
parents:
diff changeset
   846
        attrList.put(SchemaSymbols.ATT_ATTRIBUTEFORMDEFAULT, allAttrs[ATT_ATTRIBUTE_FD_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   847
        // blockDefault = (#all | List of (substitution | extension | restriction | list | union))  : ''
7f561c08de6b Initial load
duke
parents:
diff changeset
   848
        attrList.put(SchemaSymbols.ATT_BLOCKDEFAULT, allAttrs[ATT_BLOCK_D_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   849
        // elementFormDefault = (qualified | unqualified) : unqualified
7f561c08de6b Initial load
duke
parents:
diff changeset
   850
        attrList.put(SchemaSymbols.ATT_ELEMENTFORMDEFAULT, allAttrs[ATT_ELEMENT_FD_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   851
        // finalDefault = (#all | List of (extension | restriction | list | union))  : ''
7f561c08de6b Initial load
duke
parents:
diff changeset
   852
        attrList.put(SchemaSymbols.ATT_FINALDEFAULT, allAttrs[ATT_FINAL_D_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   853
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   854
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   855
        // targetNamespace = anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   856
        attrList.put(SchemaSymbols.ATT_TARGETNAMESPACE, allAttrs[ATT_TARGET_N_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   857
        // version = token
7f561c08de6b Initial load
duke
parents:
diff changeset
   858
        attrList.put(SchemaSymbols.ATT_VERSION, allAttrs[ATT_VERSION_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   859
        // xml:lang = language
7f561c08de6b Initial load
duke
parents:
diff changeset
   860
        attrList.put(SchemaSymbols.ATT_XML_LANG, allAttrs[ATT_XML_LANG]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   861
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   862
        fEleAttrsMapG.put(SchemaSymbols.ELT_SCHEMA, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   863
7f561c08de6b Initial load
duke
parents:
diff changeset
   864
        // for element "include" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   865
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   866
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   867
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   868
        // schemaLocation = anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   869
        attrList.put(SchemaSymbols.ATT_SCHEMALOCATION, allAttrs[ATT_SCHEMA_L_R]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   870
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   871
        fEleAttrsMapG.put(SchemaSymbols.ELT_INCLUDE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   872
        // for element "redefine" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   873
        fEleAttrsMapG.put(SchemaSymbols.ELT_REDEFINE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   874
7f561c08de6b Initial load
duke
parents:
diff changeset
   875
        // for element "import" - global
7f561c08de6b Initial load
duke
parents:
diff changeset
   876
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   877
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   878
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   879
        // namespace = anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   880
        attrList.put(SchemaSymbols.ATT_NAMESPACE, allAttrs[ATT_NAMESPACE_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   881
        // schemaLocation = anyURI
7f561c08de6b Initial load
duke
parents:
diff changeset
   882
        attrList.put(SchemaSymbols.ATT_SCHEMALOCATION, allAttrs[ATT_SCHEMA_L_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   883
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   884
        fEleAttrsMapG.put(SchemaSymbols.ELT_IMPORT, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   885
7f561c08de6b Initial load
duke
parents:
diff changeset
   886
        // for element "length" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   887
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   888
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   889
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   890
        // value = nonNegativeInteger
7f561c08de6b Initial load
duke
parents:
diff changeset
   891
        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_NNI_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   892
        // fixed = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   893
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   894
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   895
        fEleAttrsMapL.put(SchemaSymbols.ELT_LENGTH, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   896
        // for element "minLength" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   897
        fEleAttrsMapL.put(SchemaSymbols.ELT_MINLENGTH, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   898
        // for element "maxLength" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   899
        fEleAttrsMapL.put(SchemaSymbols.ELT_MAXLENGTH, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   900
        // for element "fractionDigits" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   901
        fEleAttrsMapL.put(SchemaSymbols.ELT_FRACTIONDIGITS, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   902
7f561c08de6b Initial load
duke
parents:
diff changeset
   903
        // for element "totalDigits" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   904
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   905
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   906
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   907
        // value = positiveInteger
7f561c08de6b Initial load
duke
parents:
diff changeset
   908
        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_PI_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   909
        // fixed = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   910
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   911
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   912
        fEleAttrsMapL.put(SchemaSymbols.ELT_TOTALDIGITS, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   913
7f561c08de6b Initial load
duke
parents:
diff changeset
   914
        // for element "pattern" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   915
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   916
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   917
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   918
        // value = string
7f561c08de6b Initial load
duke
parents:
diff changeset
   919
        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   920
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   921
        fEleAttrsMapL.put(SchemaSymbols.ELT_PATTERN, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   922
7f561c08de6b Initial load
duke
parents:
diff changeset
   923
        // for element "enumeration" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   924
        attrList = Container.getContainer(2);
7f561c08de6b Initial load
duke
parents:
diff changeset
   925
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   926
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   927
        // value = anySimpleType
7f561c08de6b Initial load
duke
parents:
diff changeset
   928
        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   929
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   930
        fEleAttrsMapL.put(SchemaSymbols.ELT_ENUMERATION, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   931
7f561c08de6b Initial load
duke
parents:
diff changeset
   932
        // for element "whiteSpace" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   933
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   934
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   935
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   936
        // value = preserve | replace | collapse
7f561c08de6b Initial load
duke
parents:
diff changeset
   937
        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_WS_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   938
        // fixed = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   939
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   940
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   941
        fEleAttrsMapL.put(SchemaSymbols.ELT_WHITESPACE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   942
7f561c08de6b Initial load
duke
parents:
diff changeset
   943
        // for element "maxInclusive" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   944
        attrList = Container.getContainer(3);
7f561c08de6b Initial load
duke
parents:
diff changeset
   945
        // id = ID
7f561c08de6b Initial load
duke
parents:
diff changeset
   946
        attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   947
        // value = anySimpleType
7f561c08de6b Initial load
duke
parents:
diff changeset
   948
        attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   949
        // fixed = boolean : false
7f561c08de6b Initial load
duke
parents:
diff changeset
   950
        attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]);
7f561c08de6b Initial load
duke
parents:
diff changeset
   951
        oneEle = new OneElement (attrList);
7f561c08de6b Initial load
duke
parents:
diff changeset
   952
        fEleAttrsMapL.put(SchemaSymbols.ELT_MAXINCLUSIVE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   953
        // for element "maxExclusive" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   954
        fEleAttrsMapL.put(SchemaSymbols.ELT_MAXEXCLUSIVE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   955
        // for element "minInclusive" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   956
        fEleAttrsMapL.put(SchemaSymbols.ELT_MININCLUSIVE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   957
        // for element "minExclusive" - local
7f561c08de6b Initial load
duke
parents:
diff changeset
   958
        fEleAttrsMapL.put(SchemaSymbols.ELT_MINEXCLUSIVE, oneEle);
7f561c08de6b Initial load
duke
parents:
diff changeset
   959
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   960
7f561c08de6b Initial load
duke
parents:
diff changeset
   961
    // used to resolver namespace prefixes
7f561c08de6b Initial load
duke
parents:
diff changeset
   962
    protected XSDHandler fSchemaHandler = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   963
7f561c08de6b Initial load
duke
parents:
diff changeset
   964
    // used to store symbols.
7f561c08de6b Initial load
duke
parents:
diff changeset
   965
    protected SymbolTable fSymbolTable = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   966
7f561c08de6b Initial load
duke
parents:
diff changeset
   967
    // used to store the mapping from processed element to attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
   968
    protected Hashtable fNonSchemaAttrs = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
   969
7f561c08de6b Initial load
duke
parents:
diff changeset
   970
    // temprory vector, used to hold the namespace list
7f561c08de6b Initial load
duke
parents:
diff changeset
   971
    protected Vector fNamespaceList = new Vector();
7f561c08de6b Initial load
duke
parents:
diff changeset
   972
7f561c08de6b Initial load
duke
parents:
diff changeset
   973
    // whether this attribute appeared in the current element
7f561c08de6b Initial load
duke
parents:
diff changeset
   974
    protected boolean[] fSeen = new boolean[ATTIDX_COUNT];
7f561c08de6b Initial load
duke
parents:
diff changeset
   975
    private static boolean[] fSeenTemp = new boolean[ATTIDX_COUNT];
7f561c08de6b Initial load
duke
parents:
diff changeset
   976
7f561c08de6b Initial load
duke
parents:
diff changeset
   977
    // constructor. Sets fErrorReproter and get datatype validators
7f561c08de6b Initial load
duke
parents:
diff changeset
   978
    public XSAttributeChecker(XSDHandler schemaHandler) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   979
        fSchemaHandler = schemaHandler;
7f561c08de6b Initial load
duke
parents:
diff changeset
   980
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   981
7f561c08de6b Initial load
duke
parents:
diff changeset
   982
    public void reset(SymbolTable symbolTable) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   983
        fSymbolTable = symbolTable;
7f561c08de6b Initial load
duke
parents:
diff changeset
   984
        fNonSchemaAttrs.clear();
7f561c08de6b Initial load
duke
parents:
diff changeset
   985
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   986
7f561c08de6b Initial load
duke
parents:
diff changeset
   987
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   988
     * Check whether the specified element conforms to the attributes restriction
7f561c08de6b Initial load
duke
parents:
diff changeset
   989
     * an array of attribute values is returned. the caller must call
7f561c08de6b Initial load
duke
parents:
diff changeset
   990
     * <code>returnAttrArray</code> to return that array.
7f561c08de6b Initial load
duke
parents:
diff changeset
   991
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   992
     * @param element    which element to check
7f561c08de6b Initial load
duke
parents:
diff changeset
   993
     * @param isGlobal   whether a child of &lt;schema&gt; or &lt;redefine&gt;
7f561c08de6b Initial load
duke
parents:
diff changeset
   994
     * @param schemaDoc  the document where the element lives in
7f561c08de6b Initial load
duke
parents:
diff changeset
   995
     * @return           an array containing attribute values
7f561c08de6b Initial load
duke
parents:
diff changeset
   996
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   997
    public Object[] checkAttributes(Element element, boolean isGlobal,
7f561c08de6b Initial load
duke
parents:
diff changeset
   998
                                    XSDocumentInfo schemaDoc) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   999
        return checkAttributes(element, isGlobal, schemaDoc, false);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1000
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1001
7f561c08de6b Initial load
duke
parents:
diff changeset
  1002
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
  1003
     * Check whether the specified element conforms to the attributes restriction
7f561c08de6b Initial load
duke
parents:
diff changeset
  1004
     * an array of attribute values is returned. the caller must call
7f561c08de6b Initial load
duke
parents:
diff changeset
  1005
     * <code>returnAttrArray</code> to return that array. This method also takes
7f561c08de6b Initial load
duke
parents:
diff changeset
  1006
     * an extra parameter: if the element is "enumeration", whether to make a
7f561c08de6b Initial load
duke
parents:
diff changeset
  1007
     * copy of the namespace context, so that the value can be resolved as a
7f561c08de6b Initial load
duke
parents:
diff changeset
  1008
     * QName later.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1009
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
  1010
     * @param element      which element to check
7f561c08de6b Initial load
duke
parents:
diff changeset
  1011
     * @param isGlobal     whether a child of &lt;schema&gt; or &lt;redefine&gt;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1012
     * @param schemaDoc    the document where the element lives in
7f561c08de6b Initial load
duke
parents:
diff changeset
  1013
     * @param enumAsQName  whether to tread enumeration value as QName
7f561c08de6b Initial load
duke
parents:
diff changeset
  1014
     * @return             an array containing attribute values
7f561c08de6b Initial load
duke
parents:
diff changeset
  1015
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
  1016
    public Object[] checkAttributes(Element element, boolean isGlobal,
7f561c08de6b Initial load
duke
parents:
diff changeset
  1017
                                    XSDocumentInfo schemaDoc, boolean enumAsQName) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1018
        if (element == null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1019
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1020
7f561c08de6b Initial load
duke
parents:
diff changeset
  1021
        // get all attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
  1022
        Attr[] attrs = DOMUtil.getAttrs(element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1023
7f561c08de6b Initial load
duke
parents:
diff changeset
  1024
        // update NamespaceSupport
7f561c08de6b Initial load
duke
parents:
diff changeset
  1025
        resolveNamespace(element, attrs, schemaDoc.fNamespaceSupport);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1026
7f561c08de6b Initial load
duke
parents:
diff changeset
  1027
        String uri = DOMUtil.getNamespaceURI(element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1028
        String elName = DOMUtil.getLocalName(element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1029
7f561c08de6b Initial load
duke
parents:
diff changeset
  1030
        if (!SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(uri)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1031
            reportSchemaError("s4s-elt-schema-ns", new Object[] {elName}, element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1032
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1033
7f561c08de6b Initial load
duke
parents:
diff changeset
  1034
        Hashtable eleAttrsMap = fEleAttrsMapG;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1035
        String lookupName = elName;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1036
7f561c08de6b Initial load
duke
parents:
diff changeset
  1037
        // REVISIT: only local element and attribute are different from others.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1038
        //          it's possible to have either name or ref. all the others
7f561c08de6b Initial load
duke
parents:
diff changeset
  1039
        //          are only allowed to have one of name or ref, or neither of them.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1040
        //          we'd better move such checking to the traverser.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1041
        if (!isGlobal) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1042
            eleAttrsMap = fEleAttrsMapL;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1043
            if (elName.equals(SchemaSymbols.ELT_ELEMENT)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1044
                if (DOMUtil.getAttr(element, SchemaSymbols.ATT_REF) != null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1045
                    lookupName = ELEMENT_R;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1046
                else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1047
                    lookupName = ELEMENT_N;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1048
            } else if (elName.equals(SchemaSymbols.ELT_ATTRIBUTE)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1049
                if (DOMUtil.getAttr(element, SchemaSymbols.ATT_REF) != null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1050
                    lookupName = ATTRIBUTE_R;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1051
                else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1052
                    lookupName = ATTRIBUTE_N;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1053
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1054
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1055
7f561c08de6b Initial load
duke
parents:
diff changeset
  1056
        // get desired attribute list of this element
7f561c08de6b Initial load
duke
parents:
diff changeset
  1057
        OneElement oneEle = (OneElement)eleAttrsMap.get(lookupName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1058
        if (oneEle == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1059
            // should never gets here.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1060
            // when this method is called, the call already knows that
7f561c08de6b Initial load
duke
parents:
diff changeset
  1061
            // the element can appear.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1062
            reportSchemaError ("s4s-elt-invalid", new Object[] {elName}, element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1063
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1064
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1065
7f561c08de6b Initial load
duke
parents:
diff changeset
  1066
        //Hashtable attrValues = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1067
        Object[] attrValues = getAvailableArray();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1068
        //Hashtable otherValues = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1069
        long fromDefault = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1070
        Container attrList = oneEle.attrList;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1071
7f561c08de6b Initial load
duke
parents:
diff changeset
  1072
        // clear the "seen" flag.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1073
        System.arraycopy(fSeenTemp, 0, fSeen, 0, ATTIDX_COUNT);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1074
7f561c08de6b Initial load
duke
parents:
diff changeset
  1075
        // traverse all attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
  1076
        int length = attrs.length;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1077
        Attr sattr = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1078
        for (int i = 0; i < length; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1079
            sattr = attrs[i];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1080
            // get the attribute name/value
7f561c08de6b Initial load
duke
parents:
diff changeset
  1081
            //String attrName = DOMUtil.getLocalName(sattr);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1082
            String attrName = sattr.getName();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1083
            String attrURI = DOMUtil.getNamespaceURI(sattr);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1084
            String attrVal = DOMUtil.getValue(sattr);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1085
7f561c08de6b Initial load
duke
parents:
diff changeset
  1086
            if (attrName.startsWith("xml")) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1087
                String attrPrefix = DOMUtil.getPrefix(sattr);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1088
                // we don't want to add namespace declarations to the non-schema attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
  1089
                if ("xmlns".equals(attrPrefix) || "xmlns".equals(attrName)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1090
                    continue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1091
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1092
                // Both <schema> and <documentation> may have an xml:lang attribute.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1093
                // Set the URI for this attribute to null so that we process it
7f561c08de6b Initial load
duke
parents:
diff changeset
  1094
                // like any other schema attribute.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1095
                else if (SchemaSymbols.ATT_XML_LANG.equals(attrName) &&
7f561c08de6b Initial load
duke
parents:
diff changeset
  1096
                        (SchemaSymbols.ELT_SCHEMA.equals(elName) ||
7f561c08de6b Initial load
duke
parents:
diff changeset
  1097
                                SchemaSymbols.ELT_DOCUMENTATION.equals(elName))) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1098
                    attrURI = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1099
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1100
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1101
7f561c08de6b Initial load
duke
parents:
diff changeset
  1102
            // for attributes with namespace prefix
7f561c08de6b Initial load
duke
parents:
diff changeset
  1103
            //
7f561c08de6b Initial load
duke
parents:
diff changeset
  1104
            if (attrURI != null && attrURI.length() != 0) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1105
                // attributes with schema namespace are not allowed
7f561c08de6b Initial load
duke
parents:
diff changeset
  1106
                // and not allowed on "document" and "appInfo"
7f561c08de6b Initial load
duke
parents:
diff changeset
  1107
                if (attrURI.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA) ||
7f561c08de6b Initial load
duke
parents:
diff changeset
  1108
                    !oneEle.allowNonSchemaAttr) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1109
                    reportSchemaError ("s4s-att-not-allowed", new Object[] {elName, attrName}, element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1110
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1111
                else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1112
                    if(attrValues[ATTIDX_NONSCHEMA] == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1113
                        // these are usually small
7f561c08de6b Initial load
duke
parents:
diff changeset
  1114
                        attrValues[ATTIDX_NONSCHEMA] = new Vector(4,2);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1115
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1116
                    ((Vector)attrValues[ATTIDX_NONSCHEMA]).addElement(attrName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1117
                    ((Vector)attrValues[ATTIDX_NONSCHEMA]).addElement(attrVal);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1118
                    // for attributes from other namespace
7f561c08de6b Initial load
duke
parents:
diff changeset
  1119
                    // store them in a list, and TRY to validate them after
7f561c08de6b Initial load
duke
parents:
diff changeset
  1120
                    // schema traversal (because it's "lax")
7f561c08de6b Initial load
duke
parents:
diff changeset
  1121
                    //otherValues.put(attrName, attrVal);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1122
                    // REVISIT:  actually use this some day...
7f561c08de6b Initial load
duke
parents:
diff changeset
  1123
                    // String attrRName = attrURI + "," + attrName;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1124
                    // Vector values = (Vector)fNonSchemaAttrs.get(attrRName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1125
                    // if (values == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1126
                        // values = new Vector();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1127
                        // values.addElement(attrName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1128
                        // values.addElement(elName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1129
                        // values.addElement(attrVal);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1130
                        // fNonSchemaAttrs.put(attrRName, values);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1131
                    // }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1132
                    // else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1133
                        // values.addElement(elName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1134
                        // values.addElement(attrVal);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1135
                    // }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1136
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1137
                continue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1138
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1139
7f561c08de6b Initial load
duke
parents:
diff changeset
  1140
            // check whether this attribute is allowed
7f561c08de6b Initial load
duke
parents:
diff changeset
  1141
            OneAttr oneAttr = (OneAttr)attrList.get(attrName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1142
            if (oneAttr == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1143
                reportSchemaError ("s4s-att-not-allowed",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1144
                                   new Object[] {elName, attrName},
7f561c08de6b Initial load
duke
parents:
diff changeset
  1145
                                   element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1146
                continue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1147
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1148
7f561c08de6b Initial load
duke
parents:
diff changeset
  1149
            // we've seen this attribute
7f561c08de6b Initial load
duke
parents:
diff changeset
  1150
            fSeen[oneAttr.valueIndex] = true;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1151
7f561c08de6b Initial load
duke
parents:
diff changeset
  1152
            // check the value against the datatype
7f561c08de6b Initial load
duke
parents:
diff changeset
  1153
            try {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1154
                // no checking on string needs to be done here.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1155
                // no checking on xpath needs to be done here.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1156
                // xpath values are validated in xpath parser
7f561c08de6b Initial load
duke
parents:
diff changeset
  1157
                if (oneAttr.dvIndex >= 0) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1158
                    if (oneAttr.dvIndex != DT_STRING &&
7f561c08de6b Initial load
duke
parents:
diff changeset
  1159
                        oneAttr.dvIndex != DT_XPATH &&
7f561c08de6b Initial load
duke
parents:
diff changeset
  1160
                        oneAttr.dvIndex != DT_XPATH1) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1161
                        XSSimpleType dv = fExtraDVs[oneAttr.dvIndex];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1162
                        Object avalue = dv.validate(attrVal, schemaDoc.fValidationContext, null);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1163
                        // kludge to handle chameleon includes/redefines...
7f561c08de6b Initial load
duke
parents:
diff changeset
  1164
                        if (oneAttr.dvIndex == DT_QNAME) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1165
                            QName qname = (QName)avalue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1166
                            if(qname.prefix == XMLSymbols.EMPTY_STRING && qname.uri == null && schemaDoc.fIsChameleonSchema)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1167
                                qname.uri = schemaDoc.fTargetNamespace;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1168
                        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1169
                        attrValues[oneAttr.valueIndex] = avalue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1170
                    } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1171
                        attrValues[oneAttr.valueIndex] = attrVal;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1172
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1173
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1174
                else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1175
                    attrValues[oneAttr.valueIndex] = validate(attrValues, attrName, attrVal, oneAttr.dvIndex, schemaDoc);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1176
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1177
            } catch (InvalidDatatypeValueException ide) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1178
                reportSchemaError ("s4s-att-invalid-value",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1179
                                   new Object[] {elName, attrName, ide.getMessage()},
7f561c08de6b Initial load
duke
parents:
diff changeset
  1180
                                   element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1181
                if (oneAttr.dfltValue != null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1182
                    //attrValues.put(attrName, oneAttr.dfltValue);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1183
                    attrValues[oneAttr.valueIndex] = oneAttr.dfltValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1184
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1185
7f561c08de6b Initial load
duke
parents:
diff changeset
  1186
            // For "enumeration", and type is possible to be a QName, we need
7f561c08de6b Initial load
duke
parents:
diff changeset
  1187
            // to return namespace context for later QName resolution.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1188
            if (elName.equals(SchemaSymbols.ELT_ENUMERATION) && enumAsQName) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1189
                attrValues[ATTIDX_ENUMNSDECLS] = new SchemaNamespaceSupport(schemaDoc.fNamespaceSupport);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1190
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1191
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1192
7f561c08de6b Initial load
duke
parents:
diff changeset
  1193
        // apply default values
7f561c08de6b Initial load
duke
parents:
diff changeset
  1194
        OneAttr[] reqAttrs = oneEle.attrList.values;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1195
        for (int i = 0; i < reqAttrs.length; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1196
            OneAttr oneAttr = reqAttrs[i];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1197
7f561c08de6b Initial load
duke
parents:
diff changeset
  1198
            // if the attribute didn't apprear, and
7f561c08de6b Initial load
duke
parents:
diff changeset
  1199
            // if the attribute is optional with default value, apply it
7f561c08de6b Initial load
duke
parents:
diff changeset
  1200
            if (oneAttr.dfltValue != null && !fSeen[oneAttr.valueIndex]) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1201
                //attrValues.put(oneAttr.name, oneAttr.dfltValue);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1202
                attrValues[oneAttr.valueIndex] = oneAttr.dfltValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1203
                fromDefault |= (1<<oneAttr.valueIndex);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1204
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1205
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1206
7f561c08de6b Initial load
duke
parents:
diff changeset
  1207
        attrValues[ATTIDX_FROMDEFAULT] = new Long(fromDefault);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1208
        //attrValues[ATTIDX_OTHERVALUES] = otherValues;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1209
7f561c08de6b Initial load
duke
parents:
diff changeset
  1210
        // Check that minOccurs isn't greater than maxOccurs.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1211
        // p-props-correct 2.1
7f561c08de6b Initial load
duke
parents:
diff changeset
  1212
        if (attrValues[ATTIDX_MAXOCCURS] != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1213
            int min = ((XInt)attrValues[ATTIDX_MINOCCURS]).intValue();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1214
            int max = ((XInt)attrValues[ATTIDX_MAXOCCURS]).intValue();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1215
            if (max != SchemaSymbols.OCCURRENCE_UNBOUNDED) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1216
2669
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1217
                // maxOccurLimit is only check in secure mode
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1218
                if (fSchemaHandler.fSecureProcessing != null) {
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1219
                    String localName = element.getLocalName();
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1220
6
7f561c08de6b Initial load
duke
parents:
diff changeset
  1221
                // The maxOccurs restriction no longer applies to elements
2669
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1222
                    // and wildcards in a sequence in which they are the only
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1223
                    // particle. These are now validated using a constant
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1224
                    // space algorithm. The restriction still applies to all
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1225
                    // other cases.
6
7f561c08de6b Initial load
duke
parents:
diff changeset
  1226
2669
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1227
                    // Determine if constant-space algorithm can be applied
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1228
                    final boolean optimize =
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1229
                            (localName.equals("element") || localName.equals("any")) &&
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1230
                            (element.getNextSibling() == null) &&
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1231
                            (element.getPreviousSibling() == null) &&
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1232
                            (element.getParentNode().getLocalName().equals("sequence"));
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1233
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1234
                    if (!optimize) {
6
7f561c08de6b Initial load
duke
parents:
diff changeset
  1235
                    //Revisit :: IMO this is not right place to check
7f561c08de6b Initial load
duke
parents:
diff changeset
  1236
                    // maxOccurNodeLimit.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1237
                    int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getMaxOccurNodeLimit();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1238
                    if (max > maxOccurNodeLimit) {
2669
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1239
                        reportSchemaFatalError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
  1240
7f561c08de6b Initial load
duke
parents:
diff changeset
  1241
                        // reset max values in case processing continues on error
7f561c08de6b Initial load
duke
parents:
diff changeset
  1242
                        attrValues[ATTIDX_MAXOCCURS] = fXIntPool.getXInt(maxOccurNodeLimit);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1243
                                                //new Integer(maxOccurNodeLimit);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1244
                        max = maxOccurNodeLimit;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1245
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1246
                }
2669
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1247
                }
6
7f561c08de6b Initial load
duke
parents:
diff changeset
  1248
7f561c08de6b Initial load
duke
parents:
diff changeset
  1249
                if (min > max) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1250
                    reportSchemaError ("p-props-correct.2.1",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1251
                                       new Object[] {elName, attrValues[ATTIDX_MINOCCURS], attrValues[ATTIDX_MAXOCCURS]},
7f561c08de6b Initial load
duke
parents:
diff changeset
  1252
                                       element);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1253
                    attrValues[ATTIDX_MINOCCURS] = attrValues[ATTIDX_MAXOCCURS];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1254
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1255
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1256
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1257
7f561c08de6b Initial load
duke
parents:
diff changeset
  1258
        return attrValues;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1259
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1260
7f561c08de6b Initial load
duke
parents:
diff changeset
  1261
    private Object validate(Object[] attrValues, String attr, String ivalue, int dvIndex,
7f561c08de6b Initial load
duke
parents:
diff changeset
  1262
                            XSDocumentInfo schemaDoc) throws InvalidDatatypeValueException {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1263
        if (ivalue == null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1264
            return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1265
7f561c08de6b Initial load
duke
parents:
diff changeset
  1266
        // To validate these types, we don't actually need to normalize the
7f561c08de6b Initial load
duke
parents:
diff changeset
  1267
        // strings. We only need to remove the whitespace from both ends.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1268
        // In some special cases (list types), StringTokenizer can correctly
7f561c08de6b Initial load
duke
parents:
diff changeset
  1269
        // process the un-normalized whitespace.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1270
        /**
7f561c08de6b Initial load
duke
parents:
diff changeset
  1271
         * REVISIT: Trim removes all leading and trailing characters less
7f561c08de6b Initial load
duke
parents:
diff changeset
  1272
         * than or equal to U+0020. This is okay for XML 1.0 since all
7f561c08de6b Initial load
duke
parents:
diff changeset
  1273
         * of the valid characters in that range are white space but
7f561c08de6b Initial load
duke
parents:
diff changeset
  1274
         * in XML 1.1 control chars are allowed. We shouldn't be trimming
7f561c08de6b Initial load
duke
parents:
diff changeset
  1275
         * those. -- mrglavas
7f561c08de6b Initial load
duke
parents:
diff changeset
  1276
         */
7f561c08de6b Initial load
duke
parents:
diff changeset
  1277
        String value = ivalue.trim();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1278
        Object retValue = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1279
        Vector memberType;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1280
        int choice;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1281
7f561c08de6b Initial load
duke
parents:
diff changeset
  1282
        switch (dvIndex) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1283
        case DT_BOOLEAN:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1284
            if (value.equals(SchemaSymbols.ATTVAL_FALSE) ||
7f561c08de6b Initial load
duke
parents:
diff changeset
  1285
                value.equals(SchemaSymbols.ATTVAL_FALSE_0)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1286
                retValue = Boolean.FALSE;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1287
            } else if (value.equals(SchemaSymbols.ATTVAL_TRUE) ||
7f561c08de6b Initial load
duke
parents:
diff changeset
  1288
                       value.equals(SchemaSymbols.ATTVAL_TRUE_1)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1289
                retValue = Boolean.TRUE;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1290
            } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1291
                throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{value, "boolean"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1292
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1293
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1294
        case DT_NONNEGINT:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1295
            try {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1296
                if (value.length() > 0 && value.charAt(0) == '+')
7f561c08de6b Initial load
duke
parents:
diff changeset
  1297
                    value = value.substring(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1298
                retValue = fXIntPool.getXInt(Integer.parseInt(value));
7f561c08de6b Initial load
duke
parents:
diff changeset
  1299
            } catch (NumberFormatException e) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1300
                throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{value, "nonNegativeInteger"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1301
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1302
            if (((XInt)retValue).intValue() < 0)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1303
                throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{value, "nonNegativeInteger"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1304
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1305
        case DT_POSINT:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1306
            try {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1307
                if (value.length() > 0 && value.charAt(0) == '+')
7f561c08de6b Initial load
duke
parents:
diff changeset
  1308
                    value = value.substring(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1309
                retValue = fXIntPool.getXInt(Integer.parseInt(value));
7f561c08de6b Initial load
duke
parents:
diff changeset
  1310
            } catch (NumberFormatException e) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1311
                throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{value, "positiveInteger"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1312
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1313
            if (((XInt)retValue).intValue() <= 0)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1314
                throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{value, "positiveInteger"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1315
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1316
        case DT_BLOCK:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1317
            // block = (#all | List of (substitution | extension | restriction | list | union))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1318
            choice = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1319
            if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1320
                choice = XSConstants.DERIVATION_SUBSTITUTION|XSConstants.DERIVATION_EXTENSION|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1321
                         XSConstants.DERIVATION_RESTRICTION|XSConstants.DERIVATION_LIST|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1322
                         XSConstants.DERIVATION_UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1323
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1324
            else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1325
                // use the default \t\r\n\f delimiters
7f561c08de6b Initial load
duke
parents:
diff changeset
  1326
                StringTokenizer t = new StringTokenizer(value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1327
                while (t.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1328
                    String token = t.nextToken ();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1329
7f561c08de6b Initial load
duke
parents:
diff changeset
  1330
                    if (token.equals (SchemaSymbols.ATTVAL_SUBSTITUTION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1331
                        choice |= XSConstants.DERIVATION_SUBSTITUTION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1332
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1333
                    else if (token.equals (SchemaSymbols.ATTVAL_EXTENSION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1334
                        choice |= XSConstants.DERIVATION_EXTENSION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1335
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1336
                    else if (token.equals (SchemaSymbols.ATTVAL_RESTRICTION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1337
                        choice |= XSConstants.DERIVATION_RESTRICTION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1338
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1339
                    else if (token.equals (SchemaSymbols.ATTVAL_LIST)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1340
                        choice |= XSConstants.DERIVATION_LIST;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1341
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1342
                    else if (token.equals (SchemaSymbols.ATTVAL_UNION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1343
                        choice |= XSConstants.DERIVATION_UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1344
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1345
                    else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1346
                        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.3", new Object[]{value, "(#all | List of (substitution | extension | restriction | list | union))"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1347
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1348
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1349
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1350
            retValue = fXIntPool.getXInt(choice);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1351
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1352
        case DT_BLOCK1:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1353
        case DT_FINAL:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1354
            // block = (#all | List of (extension | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1355
            // final = (#all | List of (extension | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1356
            choice = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1357
            if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1358
                //choice = SchemaSymbols.EXTENSION|SchemaSymbols.RESTRICTION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1359
                // REVISIT: if #all, then make the result the combination of
7f561c08de6b Initial load
duke
parents:
diff changeset
  1360
                //          everything: substitution/externsion/restriction/list/union.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1361
                //          would this be a problem?
7f561c08de6b Initial load
duke
parents:
diff changeset
  1362
                // the reason doing so is that when final/blockFinal on <schema>
7f561c08de6b Initial load
duke
parents:
diff changeset
  1363
                // is #all, it's not always the same as the conbination of those
7f561c08de6b Initial load
duke
parents:
diff changeset
  1364
                // values allowed by final/blockFinal.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1365
                // for example, finalDefault="#all" is not always the same as
7f561c08de6b Initial load
duke
parents:
diff changeset
  1366
                // finalDefault="extension restriction".
7f561c08de6b Initial load
duke
parents:
diff changeset
  1367
                // if finalDefault="#all", final on any simple type would be
7f561c08de6b Initial load
duke
parents:
diff changeset
  1368
                // "extension restriction list union".
7f561c08de6b Initial load
duke
parents:
diff changeset
  1369
                choice = XSConstants.DERIVATION_SUBSTITUTION|XSConstants.DERIVATION_EXTENSION|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1370
                         XSConstants.DERIVATION_RESTRICTION|XSConstants.DERIVATION_LIST|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1371
                         XSConstants.DERIVATION_UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1372
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1373
            else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1374
                // use the default \t\r\n\f delimiters
7f561c08de6b Initial load
duke
parents:
diff changeset
  1375
                StringTokenizer t = new StringTokenizer(value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1376
                while (t.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1377
                    String token = t.nextToken ();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1378
7f561c08de6b Initial load
duke
parents:
diff changeset
  1379
                    if (token.equals (SchemaSymbols.ATTVAL_EXTENSION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1380
                        choice |= XSConstants.DERIVATION_EXTENSION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1381
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1382
                    else if (token.equals (SchemaSymbols.ATTVAL_RESTRICTION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1383
                        choice |= XSConstants.DERIVATION_RESTRICTION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1384
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1385
                    else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1386
                        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.3", new Object[]{value, "(#all | List of (extension | restriction))"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1387
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1388
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1389
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1390
            retValue = fXIntPool.getXInt(choice);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1391
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1392
        case DT_FINAL1:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1393
            // final = (#all | List of (list | union | restriction))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1394
            choice = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1395
            if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1396
                //choice = SchemaSymbols.RESTRICTION|SchemaSymbols.LIST|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1397
                //         SchemaSymbols.UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1398
                // REVISIT: if #all, then make the result the combination of
7f561c08de6b Initial load
duke
parents:
diff changeset
  1399
                //          everything: substitution/externsion/restriction/list/union.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1400
                //          would this be a problem?
7f561c08de6b Initial load
duke
parents:
diff changeset
  1401
                // same reason as above DT_BLOCK1/DT_FINAL
7f561c08de6b Initial load
duke
parents:
diff changeset
  1402
                choice = XSConstants.DERIVATION_SUBSTITUTION|XSConstants.DERIVATION_EXTENSION|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1403
                         XSConstants.DERIVATION_RESTRICTION|XSConstants.DERIVATION_LIST|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1404
                         XSConstants.DERIVATION_UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1405
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1406
            else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1407
                // use the default \t\r\n\f delimiters
7f561c08de6b Initial load
duke
parents:
diff changeset
  1408
                StringTokenizer t = new StringTokenizer(value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1409
                while (t.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1410
                    String token = t.nextToken ();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1411
7f561c08de6b Initial load
duke
parents:
diff changeset
  1412
                    if (token.equals (SchemaSymbols.ATTVAL_LIST)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1413
                        choice |= XSConstants.DERIVATION_LIST;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1414
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1415
                    else if (token.equals (SchemaSymbols.ATTVAL_UNION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1416
                        choice |= XSConstants.DERIVATION_UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1417
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1418
                    else if (token.equals (SchemaSymbols.ATTVAL_RESTRICTION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1419
                        choice |= XSConstants.DERIVATION_RESTRICTION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1420
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1421
                    else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1422
                        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.3", new Object[]{value, "(#all | List of (list | union | restriction))"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1423
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1424
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1425
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1426
            retValue = fXIntPool.getXInt(choice);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1427
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1428
        case DT_FINAL2:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1429
            // finalDefault = (#all | List of (extension | restriction | list | union))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1430
            choice = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1431
            if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1432
                //choice = SchemaSymbols.RESTRICTION|SchemaSymbols.LIST|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1433
                //         SchemaSymbols.UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1434
                // REVISIT: if #all, then make the result the combination of
7f561c08de6b Initial load
duke
parents:
diff changeset
  1435
                //          everything: substitution/externsion/restriction/list/union.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1436
                //          would this be a problem?
7f561c08de6b Initial load
duke
parents:
diff changeset
  1437
                // same reason as above DT_BLOCK1/DT_FINAL
7f561c08de6b Initial load
duke
parents:
diff changeset
  1438
                choice = XSConstants.DERIVATION_SUBSTITUTION|XSConstants.DERIVATION_EXTENSION|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1439
                         XSConstants.DERIVATION_RESTRICTION|XSConstants.DERIVATION_LIST|
7f561c08de6b Initial load
duke
parents:
diff changeset
  1440
                         XSConstants.DERIVATION_UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1441
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1442
            else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1443
                // use the default \t\r\n\f delimiters
7f561c08de6b Initial load
duke
parents:
diff changeset
  1444
                StringTokenizer t = new StringTokenizer(value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1445
                while (t.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1446
                    String token = t.nextToken ();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1447
7f561c08de6b Initial load
duke
parents:
diff changeset
  1448
                    if (token.equals (SchemaSymbols.ATTVAL_EXTENSION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1449
                        choice |= XSConstants.DERIVATION_EXTENSION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1450
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1451
                    else if (token.equals (SchemaSymbols.ATTVAL_RESTRICTION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1452
                        choice |= XSConstants.DERIVATION_RESTRICTION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1453
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1454
                    else if (token.equals (SchemaSymbols.ATTVAL_LIST)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1455
                        choice |= XSConstants.DERIVATION_LIST;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1456
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1457
                    else if (token.equals (SchemaSymbols.ATTVAL_UNION)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1458
                        choice |= XSConstants.DERIVATION_UNION;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1459
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1460
                    else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1461
                        throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.3", new Object[]{value, "(#all | List of (extension | restriction | list | union))"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1462
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1463
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1464
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1465
            retValue = fXIntPool.getXInt(choice);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1466
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1467
        case DT_FORM:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1468
            // form = (qualified | unqualified)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1469
            if (value.equals (SchemaSymbols.ATTVAL_QUALIFIED))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1470
                retValue = INT_QUALIFIED;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1471
            else if (value.equals (SchemaSymbols.ATTVAL_UNQUALIFIED))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1472
                retValue = INT_UNQUALIFIED;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1473
            else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1474
                throw new InvalidDatatypeValueException("cvc-enumeration-valid",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1475
                                                        new Object[]{value, "(qualified | unqualified)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1476
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1477
        case DT_MAXOCCURS:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1478
            // maxOccurs = (nonNegativeInteger | unbounded)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1479
            if (value.equals(SchemaSymbols.ATTVAL_UNBOUNDED)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1480
                retValue = INT_UNBOUNDED;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1481
            } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1482
                try {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1483
                    retValue = validate(attrValues, attr, value, DT_NONNEGINT, schemaDoc);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1484
                } catch (NumberFormatException e) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1485
                    throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.3", new Object[]{value, "(nonNegativeInteger | unbounded)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1486
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1487
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1488
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1489
        case DT_MAXOCCURS1:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1490
            // maxOccurs = 1
7f561c08de6b Initial load
duke
parents:
diff changeset
  1491
            if (value.equals("1"))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1492
                retValue = fXIntPool.getXInt(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1493
            else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1494
                throw new InvalidDatatypeValueException("cvc-enumeration-valid",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1495
                                                        new Object[]{value, "(1)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1496
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1497
        case DT_MEMBERTYPES:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1498
            // memberTypes = List of QName
7f561c08de6b Initial load
duke
parents:
diff changeset
  1499
            memberType = new Vector();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1500
            try {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1501
                // use the default \t\r\n\f delimiters
7f561c08de6b Initial load
duke
parents:
diff changeset
  1502
                StringTokenizer t = new StringTokenizer(value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1503
                while (t.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1504
                    String token = t.nextToken ();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1505
                    QName qname = (QName)fExtraDVs[DT_QNAME].validate(token, schemaDoc.fValidationContext, null);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1506
                    // kludge to handle chameleon includes/redefines...
7f561c08de6b Initial load
duke
parents:
diff changeset
  1507
                    if(qname.prefix == XMLSymbols.EMPTY_STRING && qname.uri == null && schemaDoc.fIsChameleonSchema)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1508
                        qname.uri = schemaDoc.fTargetNamespace;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1509
                    memberType.addElement(qname);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1510
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1511
                retValue = memberType;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1512
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1513
            catch (InvalidDatatypeValueException ide) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1514
                throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.2", new Object[]{value, "(List of QName)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1515
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1516
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1517
        case DT_MINOCCURS1:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1518
            // minOccurs = (0 | 1)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1519
            if (value.equals("0"))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1520
                retValue = fXIntPool.getXInt(0);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1521
            else if (value.equals("1"))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1522
                retValue = fXIntPool.getXInt(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1523
            else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1524
                throw new InvalidDatatypeValueException("cvc-enumeration-valid",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1525
                                                        new Object[]{value, "(0 | 1)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1526
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1527
        case DT_NAMESPACE:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1528
            // namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )
7f561c08de6b Initial load
duke
parents:
diff changeset
  1529
            if (value.equals(SchemaSymbols.ATTVAL_TWOPOUNDANY)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1530
                // ##any
7f561c08de6b Initial load
duke
parents:
diff changeset
  1531
                retValue = INT_ANY_ANY;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1532
            } else if (value.equals(SchemaSymbols.ATTVAL_TWOPOUNDOTHER)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1533
                // ##other
7f561c08de6b Initial load
duke
parents:
diff changeset
  1534
                retValue = INT_ANY_NOT;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1535
                String[] list = new String[2];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1536
                list[0] = schemaDoc.fTargetNamespace;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1537
                list[1] = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1538
                attrValues[ATTIDX_NAMESPACE_LIST] = list;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1539
            } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1540
                // list
7f561c08de6b Initial load
duke
parents:
diff changeset
  1541
                retValue = INT_ANY_LIST;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1542
7f561c08de6b Initial load
duke
parents:
diff changeset
  1543
                fNamespaceList.removeAllElements();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1544
7f561c08de6b Initial load
duke
parents:
diff changeset
  1545
                // tokenize
7f561c08de6b Initial load
duke
parents:
diff changeset
  1546
                // use the default \t\r\n\f delimiters
7f561c08de6b Initial load
duke
parents:
diff changeset
  1547
                StringTokenizer tokens = new StringTokenizer(value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1548
                String token;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1549
                String tempNamespace;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1550
                try {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1551
                    while (tokens.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1552
                        token = tokens.nextToken();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1553
                        if (token.equals(SchemaSymbols.ATTVAL_TWOPOUNDLOCAL)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1554
                            tempNamespace = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1555
                        } else if (token.equals(SchemaSymbols.ATTVAL_TWOPOUNDTARGETNS)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1556
                            tempNamespace = schemaDoc.fTargetNamespace;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1557
                        } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1558
                            // we have found namespace URI here
7f561c08de6b Initial load
duke
parents:
diff changeset
  1559
                            // need to add it to the symbol table
7f561c08de6b Initial load
duke
parents:
diff changeset
  1560
                            fExtraDVs[DT_ANYURI].validate(token, schemaDoc.fValidationContext, null);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1561
                            tempNamespace = fSymbolTable.addSymbol(token);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1562
                        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1563
7f561c08de6b Initial load
duke
parents:
diff changeset
  1564
                        //check for duplicate namespaces in the list
7f561c08de6b Initial load
duke
parents:
diff changeset
  1565
                        if (!fNamespaceList.contains(tempNamespace)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1566
                            fNamespaceList.addElement(tempNamespace);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1567
                        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1568
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1569
                } catch (InvalidDatatypeValueException ide) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1570
                    throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.3", new Object[]{value, "((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1571
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1572
7f561c08de6b Initial load
duke
parents:
diff changeset
  1573
                // convert the vector to an array
7f561c08de6b Initial load
duke
parents:
diff changeset
  1574
                int num = fNamespaceList.size();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1575
                String[] list = new String[num];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1576
                fNamespaceList.copyInto(list);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1577
                attrValues[ATTIDX_NAMESPACE_LIST] = list;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1578
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1579
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1580
        case DT_PROCESSCONTENTS:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1581
            // processContents = (lax | skip | strict)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1582
            if (value.equals (SchemaSymbols.ATTVAL_STRICT))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1583
                retValue = INT_ANY_STRICT;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1584
            else if (value.equals (SchemaSymbols.ATTVAL_LAX))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1585
                retValue = INT_ANY_LAX;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1586
            else if (value.equals (SchemaSymbols.ATTVAL_SKIP))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1587
                retValue = INT_ANY_SKIP;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1588
            else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1589
                throw new InvalidDatatypeValueException("cvc-enumeration-valid",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1590
                                                        new Object[]{value, "(lax | skip | strict)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1591
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1592
        case DT_USE:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1593
            // use = (optional | prohibited | required)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1594
            if (value.equals (SchemaSymbols.ATTVAL_OPTIONAL))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1595
                retValue = INT_USE_OPTIONAL;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1596
            else if (value.equals (SchemaSymbols.ATTVAL_REQUIRED))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1597
                retValue = INT_USE_REQUIRED;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1598
            else if (value.equals (SchemaSymbols.ATTVAL_PROHIBITED))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1599
                retValue = INT_USE_PROHIBITED;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1600
            else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1601
                throw new InvalidDatatypeValueException("cvc-enumeration-valid",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1602
                                                        new Object[]{value, "(optional | prohibited | required)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1603
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1604
        case DT_WHITESPACE:
7f561c08de6b Initial load
duke
parents:
diff changeset
  1605
            // value = preserve | replace | collapse
7f561c08de6b Initial load
duke
parents:
diff changeset
  1606
            if (value.equals (SchemaSymbols.ATTVAL_PRESERVE))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1607
                retValue = INT_WS_PRESERVE;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1608
            else if (value.equals (SchemaSymbols.ATTVAL_REPLACE))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1609
                retValue = INT_WS_REPLACE;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1610
            else if (value.equals (SchemaSymbols.ATTVAL_COLLAPSE))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1611
                retValue = INT_WS_COLLAPSE;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1612
            else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1613
                throw new InvalidDatatypeValueException("cvc-enumeration-valid",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1614
                                                        new Object[]{value, "(preserve | replace | collapse)"});
7f561c08de6b Initial load
duke
parents:
diff changeset
  1615
            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1616
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1617
7f561c08de6b Initial load
duke
parents:
diff changeset
  1618
        return retValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1619
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1620
2669
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1621
    void reportSchemaFatalError (String key, Object[] args, Element ele) {
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1622
        fSchemaHandler.reportSchemaFatalError(key, args, ele);
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1623
    }
15024792697e 6738894: Merge jaxp fixes from 6 update train into OpenJDK 6 and 7
tbell
parents: 6
diff changeset
  1624
6
7f561c08de6b Initial load
duke
parents:
diff changeset
  1625
    void reportSchemaError (String key, Object[] args, Element ele) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1626
        fSchemaHandler.reportSchemaError(key, args, ele);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1627
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1628
7f561c08de6b Initial load
duke
parents:
diff changeset
  1629
    // validate attriubtes from non-schema namespaces
7f561c08de6b Initial load
duke
parents:
diff changeset
  1630
    // REVISIT: why we store the attributes in this way? why not just a list
7f561c08de6b Initial load
duke
parents:
diff changeset
  1631
    //          of structure {element node, attr name/qname, attr value)?
7f561c08de6b Initial load
duke
parents:
diff changeset
  1632
    // REVISIT: pass the proper element node to reportSchemaError
7f561c08de6b Initial load
duke
parents:
diff changeset
  1633
    public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1634
        // for all attributes
7f561c08de6b Initial load
duke
parents:
diff changeset
  1635
        Enumeration keys = fNonSchemaAttrs.keys();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1636
        XSAttributeDecl attrDecl;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1637
        while (keys.hasMoreElements()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1638
            // get name, uri, localpart
7f561c08de6b Initial load
duke
parents:
diff changeset
  1639
            String attrRName = (String)keys.nextElement();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1640
            String attrURI = attrRName.substring(0,attrRName.indexOf(','));
7f561c08de6b Initial load
duke
parents:
diff changeset
  1641
            String attrLocal = attrRName.substring(attrRName.indexOf(',')+1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1642
            // find associated grammar
7f561c08de6b Initial load
duke
parents:
diff changeset
  1643
            SchemaGrammar sGrammar = grammarBucket.getGrammar(attrURI);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1644
            if (sGrammar == null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1645
                continue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1646
            // and get the datatype validator, if there is one
7f561c08de6b Initial load
duke
parents:
diff changeset
  1647
            attrDecl = sGrammar.getGlobalAttributeDecl(attrLocal);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1648
            if (attrDecl == null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1649
                continue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1650
            XSSimpleType dv = (XSSimpleType)attrDecl.getTypeDefinition();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1651
            if (dv == null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1652
                continue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1653
7f561c08de6b Initial load
duke
parents:
diff changeset
  1654
            // get all values appeared with this attribute name
7f561c08de6b Initial load
duke
parents:
diff changeset
  1655
            Vector values = (Vector)fNonSchemaAttrs.get(attrRName);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1656
            String elName, attrVal;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1657
            String attrName = (String)values.elementAt(0);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1658
            // for each of the values
7f561c08de6b Initial load
duke
parents:
diff changeset
  1659
            int count = values.size();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1660
            for (int i = 1; i < count; i += 2) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1661
                elName = (String)values.elementAt(i);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1662
                try {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1663
                    // and validate it using the XSSimpleType
7f561c08de6b Initial load
duke
parents:
diff changeset
  1664
                    // REVISIT: what would be the proper validation context?
7f561c08de6b Initial load
duke
parents:
diff changeset
  1665
                    //          guess we need to save that in the vectors too.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1666
                    dv.validate((String)values.elementAt(i+1), null, null);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1667
                } catch(InvalidDatatypeValueException ide) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1668
                    reportSchemaError ("s4s-att-invalid-value",
7f561c08de6b Initial load
duke
parents:
diff changeset
  1669
                                       new Object[] {elName, attrName, ide.getMessage()},
7f561c08de6b Initial load
duke
parents:
diff changeset
  1670
                                       null);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1671
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1672
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1673
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1674
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1675
7f561c08de6b Initial load
duke
parents:
diff changeset
  1676
    // normalize the string according to the whiteSpace facet
7f561c08de6b Initial load
duke
parents:
diff changeset
  1677
    public static String normalize(String content, short ws) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1678
        int len = content == null ? 0 : content.length();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1679
        if (len == 0 || ws == XSSimpleType.WS_PRESERVE)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1680
            return content;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1681
7f561c08de6b Initial load
duke
parents:
diff changeset
  1682
        StringBuffer sb = new StringBuffer();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1683
        if (ws == XSSimpleType.WS_REPLACE) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1684
            char ch;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1685
            // when it's replace, just replace #x9, #xa, #xd by #x20
7f561c08de6b Initial load
duke
parents:
diff changeset
  1686
            for (int i = 0; i < len; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1687
                ch = content.charAt(i);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1688
                if (ch != 0x9 && ch != 0xa && ch != 0xd)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1689
                    sb.append(ch);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1690
                else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1691
                    sb.append((char)0x20);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1692
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1693
        } else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1694
            char ch;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1695
            int i;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1696
            boolean isLeading = true;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1697
            // when it's collapse
7f561c08de6b Initial load
duke
parents:
diff changeset
  1698
            for (i = 0; i < len; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1699
                ch = content.charAt(i);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1700
                // append real characters, so we passed leading ws
7f561c08de6b Initial load
duke
parents:
diff changeset
  1701
                if (ch != 0x9 && ch != 0xa && ch != 0xd && ch != 0x20) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1702
                    sb.append(ch);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1703
                    isLeading = false;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1704
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1705
                else {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1706
                    // for whitespaces, we skip all following ws
7f561c08de6b Initial load
duke
parents:
diff changeset
  1707
                    for (; i < len-1; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1708
                        ch = content.charAt(i+1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1709
                        if (ch != 0x9 && ch != 0xa && ch != 0xd && ch != 0x20)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1710
                            break;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1711
                    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1712
                    // if it's not a leading or tailing ws, then append a space
7f561c08de6b Initial load
duke
parents:
diff changeset
  1713
                    if (i < len - 1 && !isLeading)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1714
                        sb.append((char)0x20);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1715
                }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1716
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1717
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1718
7f561c08de6b Initial load
duke
parents:
diff changeset
  1719
        return sb.toString();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1720
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1721
7f561c08de6b Initial load
duke
parents:
diff changeset
  1722
    // the following part implements an attribute-value-array pool.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1723
    // when checkAttribute is called, it calls getAvailableArray to get
7f561c08de6b Initial load
duke
parents:
diff changeset
  1724
    // an array from the pool; when the caller is done with the array,
7f561c08de6b Initial load
duke
parents:
diff changeset
  1725
    // it calls returnAttrArray to return that array to the pool.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1726
7f561c08de6b Initial load
duke
parents:
diff changeset
  1727
    // initial size of the array pool. 10 is big enough
7f561c08de6b Initial load
duke
parents:
diff changeset
  1728
    static final int INIT_POOL_SIZE = 10;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1729
    // the incremental size of the array pool
7f561c08de6b Initial load
duke
parents:
diff changeset
  1730
    static final int INC_POOL_SIZE  = 10;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1731
    // the array pool
7f561c08de6b Initial load
duke
parents:
diff changeset
  1732
    Object[][] fArrayPool = new Object[INIT_POOL_SIZE][ATTIDX_COUNT];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1733
    // used to clear the returned array
7f561c08de6b Initial load
duke
parents:
diff changeset
  1734
    // I think System.arrayCopy is more efficient than setting 35 fields to null
7f561c08de6b Initial load
duke
parents:
diff changeset
  1735
    private static Object[] fTempArray = new Object[ATTIDX_COUNT];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1736
    // current position of the array pool (# of arrays not returned)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1737
    int fPoolPos = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1738
7f561c08de6b Initial load
duke
parents:
diff changeset
  1739
    // get the next available array
7f561c08de6b Initial load
duke
parents:
diff changeset
  1740
    protected Object[] getAvailableArray() {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1741
        // if no array left in the pool, increase the pool size
7f561c08de6b Initial load
duke
parents:
diff changeset
  1742
        if (fArrayPool.length == fPoolPos) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1743
            // increase size
7f561c08de6b Initial load
duke
parents:
diff changeset
  1744
            fArrayPool = new Object[fPoolPos+INC_POOL_SIZE][];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1745
            // initialize each *new* array
7f561c08de6b Initial load
duke
parents:
diff changeset
  1746
            for (int i = fPoolPos; i < fArrayPool.length; i++)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1747
                fArrayPool[i] = new Object[ATTIDX_COUNT];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1748
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1749
        // get the next available one
7f561c08de6b Initial load
duke
parents:
diff changeset
  1750
        Object[] retArray = fArrayPool[fPoolPos];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1751
        // clear it from the pool. this is for GC: if a caller forget to
7f561c08de6b Initial load
duke
parents:
diff changeset
  1752
        // return the array, we want that array to be GCed.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1753
        fArrayPool[fPoolPos++] = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1754
        // to make sure that one array is not returned twice, we use
7f561c08de6b Initial load
duke
parents:
diff changeset
  1755
        // the last entry to indicate whether an array is already returned
7f561c08de6b Initial load
duke
parents:
diff changeset
  1756
        // now set it to false.
7f561c08de6b Initial load
duke
parents:
diff changeset
  1757
        System.arraycopy(fTempArray, 0, retArray, 0, ATTIDX_COUNT-1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1758
        retArray[ATTIDX_ISRETURNED] = Boolean.FALSE;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1759
7f561c08de6b Initial load
duke
parents:
diff changeset
  1760
        return retArray;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1761
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1762
7f561c08de6b Initial load
duke
parents:
diff changeset
  1763
    // return an array back to the pool
7f561c08de6b Initial load
duke
parents:
diff changeset
  1764
    public void returnAttrArray(Object[] attrArray, XSDocumentInfo schemaDoc) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1765
        // pop the namespace context
7f561c08de6b Initial load
duke
parents:
diff changeset
  1766
        if (schemaDoc != null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1767
            schemaDoc.fNamespaceSupport.popContext();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1768
7f561c08de6b Initial load
duke
parents:
diff changeset
  1769
        // if 1. the pool is full; 2. the array is null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1770
        // 3. the array is of wrong size; 4. the array is already returned
7f561c08de6b Initial load
duke
parents:
diff changeset
  1771
        // then we can't accept this array to be returned
7f561c08de6b Initial load
duke
parents:
diff changeset
  1772
        if (fPoolPos == 0 ||
7f561c08de6b Initial load
duke
parents:
diff changeset
  1773
            attrArray == null ||
7f561c08de6b Initial load
duke
parents:
diff changeset
  1774
            attrArray.length != ATTIDX_COUNT ||
7f561c08de6b Initial load
duke
parents:
diff changeset
  1775
            ((Boolean)attrArray[ATTIDX_ISRETURNED]).booleanValue()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1776
            return;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1777
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1778
7f561c08de6b Initial load
duke
parents:
diff changeset
  1779
        // mark this array as returned
7f561c08de6b Initial load
duke
parents:
diff changeset
  1780
        attrArray[ATTIDX_ISRETURNED] = Boolean.TRUE;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1781
        // better clear nonschema vector
7f561c08de6b Initial load
duke
parents:
diff changeset
  1782
        if(attrArray[ATTIDX_NONSCHEMA] != null)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1783
            ((Vector)attrArray[ATTIDX_NONSCHEMA]).clear();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1784
        // and put it into the pool
7f561c08de6b Initial load
duke
parents:
diff changeset
  1785
        fArrayPool[--fPoolPos] = attrArray;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1786
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1787
7f561c08de6b Initial load
duke
parents:
diff changeset
  1788
    public void resolveNamespace(Element element, Attr[] attrs,
7f561c08de6b Initial load
duke
parents:
diff changeset
  1789
                                 SchemaNamespaceSupport nsSupport) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1790
        // push the namespace context
7f561c08de6b Initial load
duke
parents:
diff changeset
  1791
        nsSupport.pushContext();
7f561c08de6b Initial load
duke
parents:
diff changeset
  1792
7f561c08de6b Initial load
duke
parents:
diff changeset
  1793
        // search for new namespace bindings
7f561c08de6b Initial load
duke
parents:
diff changeset
  1794
        int length = attrs.length;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1795
        Attr sattr = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1796
        String rawname, prefix, uri;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1797
        for (int i = 0; i < length; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1798
            sattr = attrs[i];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1799
            rawname = DOMUtil.getName(sattr);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1800
            prefix = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1801
            if (rawname.equals(XMLSymbols.PREFIX_XMLNS))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1802
                prefix = XMLSymbols.EMPTY_STRING;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1803
            else if (rawname.startsWith("xmlns:"))
7f561c08de6b Initial load
duke
parents:
diff changeset
  1804
                prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr));
7f561c08de6b Initial load
duke
parents:
diff changeset
  1805
            if (prefix != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1806
                uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr));
7f561c08de6b Initial load
duke
parents:
diff changeset
  1807
                nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1808
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1809
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1810
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1811
}
7f561c08de6b Initial load
duke
parents:
diff changeset
  1812
7f561c08de6b Initial load
duke
parents:
diff changeset
  1813
class OneAttr {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1814
    // name of the attribute
7f561c08de6b Initial load
duke
parents:
diff changeset
  1815
    public String name;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1816
    // index of the datatype validator
7f561c08de6b Initial load
duke
parents:
diff changeset
  1817
    public int dvIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1818
    // whether it's optional, and has default value
7f561c08de6b Initial load
duke
parents:
diff changeset
  1819
    public int valueIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1820
    // the default value of this attribute
7f561c08de6b Initial load
duke
parents:
diff changeset
  1821
    public Object dfltValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1822
7f561c08de6b Initial load
duke
parents:
diff changeset
  1823
    public OneAttr(String name, int dvIndex, int valueIndex, Object dfltValue) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1824
        this.name = name;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1825
        this.dvIndex = dvIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1826
        this.valueIndex = valueIndex;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1827
        this.dfltValue = dfltValue;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1828
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1829
}
7f561c08de6b Initial load
duke
parents:
diff changeset
  1830
7f561c08de6b Initial load
duke
parents:
diff changeset
  1831
class OneElement {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1832
    // the list of attributes that can appear in one element
7f561c08de6b Initial load
duke
parents:
diff changeset
  1833
    public Container attrList;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1834
    // does this element allow attributes from non-schema namespace
7f561c08de6b Initial load
duke
parents:
diff changeset
  1835
    public boolean allowNonSchemaAttr;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1836
7f561c08de6b Initial load
duke
parents:
diff changeset
  1837
    public OneElement (Container attrList) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1838
        this(attrList, true);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1839
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1840
7f561c08de6b Initial load
duke
parents:
diff changeset
  1841
    public OneElement (Container attrList, boolean allowNonSchemaAttr) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1842
        this.attrList = attrList;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1843
        this.allowNonSchemaAttr = allowNonSchemaAttr;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1844
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1845
}
7f561c08de6b Initial load
duke
parents:
diff changeset
  1846
7f561c08de6b Initial load
duke
parents:
diff changeset
  1847
abstract class Container {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1848
    static final int THRESHOLD = 5;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1849
    static Container getContainer(int size) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1850
        if (size > THRESHOLD)
7f561c08de6b Initial load
duke
parents:
diff changeset
  1851
            return new LargeContainer(size);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1852
        else
7f561c08de6b Initial load
duke
parents:
diff changeset
  1853
            return new SmallContainer(size);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1854
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1855
    abstract void put(String key, OneAttr value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1856
    abstract OneAttr get(String key);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1857
7f561c08de6b Initial load
duke
parents:
diff changeset
  1858
    OneAttr[] values;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1859
    int pos = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1860
}
7f561c08de6b Initial load
duke
parents:
diff changeset
  1861
7f561c08de6b Initial load
duke
parents:
diff changeset
  1862
class SmallContainer extends Container {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1863
    String[] keys;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1864
    SmallContainer(int size) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1865
        keys = new String[size];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1866
        values = new OneAttr[size];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1867
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1868
    void put(String key, OneAttr value) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1869
        keys[pos] = key;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1870
        values[pos++] = value;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1871
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1872
    OneAttr get(String key) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1873
        for (int i = 0; i < pos; i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1874
            if (keys[i].equals(key)) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1875
                return values[i];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1876
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1877
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1878
        return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1879
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1880
}
7f561c08de6b Initial load
duke
parents:
diff changeset
  1881
7f561c08de6b Initial load
duke
parents:
diff changeset
  1882
class LargeContainer extends Container {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1883
    Hashtable items;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1884
    LargeContainer(int size) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1885
        items = new Hashtable(size*2+1);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1886
        values = new OneAttr[size];
7f561c08de6b Initial load
duke
parents:
diff changeset
  1887
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1888
    void put(String key, OneAttr value) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1889
        items.put(key, value);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1890
        values[pos++] = value;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1891
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1892
    OneAttr get(String key) {
7f561c08de6b Initial load
duke
parents:
diff changeset
  1893
        OneAttr ret = (OneAttr)items.get(key);
7f561c08de6b Initial load
duke
parents:
diff changeset
  1894
        return ret;
7f561c08de6b Initial load
duke
parents:
diff changeset
  1895
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
  1896
}