jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/AttributePSVImpl.java
author joehw
Mon, 13 Oct 2014 14:09:03 -0700
changeset 27111 7a491d709b83
parent 25868 686eef1e7a79
child 45853 bfa06be36a17
permissions -rw-r--r--
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java Reviewed-by: lancea
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
/*
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     6
 * Licensed to the Apache Software Foundation (ASF) under one or more
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     7
 * contributor license agreements.  See the NOTICE file distributed with
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     8
 * this work for additional information regarding copyright ownership.
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
     9
 * The ASF licenses this file to You under the Apache License, Version 2.0
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    10
 * (the "License"); you may not use this file except in compliance with
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    11
 * the License.  You may obtain a copy of the License at
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *      http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
package com.sun.org.apache.xerces.internal.impl.xs;
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    24
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    25
import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    26
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    27
import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import com.sun.org.apache.xerces.internal.xs.ShortList;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
import com.sun.org.apache.xerces.internal.xs.StringList;
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
import com.sun.org.apache.xerces.internal.xs.XSAttributeDeclaration;
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    31
import com.sun.org.apache.xerces.internal.xs.XSConstants;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    34
import com.sun.org.apache.xerces.internal.xs.XSValue;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * Attribute PSV infoset augmentations implementation.
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * The PSVI information for attributes will be available at the startElement call.
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * @xerces.internal
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * @author Elena Litani IBM
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
public class AttributePSVImpl implements AttributePSVI {
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
    /** attribute declaration */
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
    protected XSAttributeDeclaration fDeclaration = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
    /** type of attribute, simpleType */
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
    protected XSTypeDefinition fTypeDecl = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
    /** If this attribute was explicitly given a
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
     * value in the original document, this is false; otherwise, it is true */
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
    protected boolean fSpecified = false;
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    56
    /** Schema value */
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    57
    protected ValidatedInfo fValue = new ValidatedInfo();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
    /** validation attempted: none, partial, full */
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
    protected short fValidationAttempted = AttributePSVI.VALIDATION_NONE;
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
    /** validity: valid, invalid, unknown */
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
    protected short fValidity = AttributePSVI.VALIDITY_NOTKNOWN;
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    65
    /** error codes and error messages */
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    66
    protected String[] fErrors = null;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
    /** validation context: could be QName or XPath expression*/
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
    protected String fValidationContext = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    71
    /** true if this object is immutable **/
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    72
    protected boolean fIsConstant;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    73
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    74
    public AttributePSVImpl() {}
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    75
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    76
    public AttributePSVImpl(boolean isConstant, AttributePSVI attrPSVI) {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    77
        fDeclaration = attrPSVI.getAttributeDeclaration();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    78
        fTypeDecl = attrPSVI.getTypeDefinition();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    79
        fSpecified = attrPSVI.getIsSchemaSpecified();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    80
        fValue.copyFrom(attrPSVI.getSchemaValue());
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    81
        fValidationAttempted = attrPSVI.getValidationAttempted();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    82
        fValidity = attrPSVI.getValidity();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    83
        if (attrPSVI instanceof AttributePSVImpl) {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    84
            final AttributePSVImpl attrPSVIImpl = (AttributePSVImpl) attrPSVI;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    85
            fErrors = (attrPSVIImpl.fErrors != null) ?
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    86
                    (String[]) attrPSVIImpl.fErrors.clone() : null;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    87
        }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    88
        else {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    89
            final StringList errorCodes = attrPSVI.getErrorCodes();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    90
            final int length = errorCodes.getLength();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    91
            if (length > 0) {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    92
                final StringList errorMessages = attrPSVI.getErrorMessages();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    93
                final String[] errors = new String[length << 1];
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    94
                for (int i = 0, j = 0; i < length; ++i) {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    95
                    errors[j++] = errorCodes.item(i);
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    96
                    errors[j++] = errorMessages.item(i);
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    97
                }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    98
                fErrors = errors;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
    99
            }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   100
        }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   101
        fValidationContext = attrPSVI.getValidationContext();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   102
        fIsConstant = isConstant;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   103
    }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   104
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    // AttributePSVI methods
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
    //
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   109
    /* (non-Javadoc)
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   110
     * @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#constant()
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   111
     */
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   112
    public ItemPSVI constant() {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   113
        if (isConstant()) {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   114
            return this;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   115
        }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   116
        return new AttributePSVImpl(true, this);
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   117
    }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   118
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   119
    /* (non-Javadoc)
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   120
     * @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#isConstant()
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   121
     */
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   122
    public boolean isConstant() {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   123
        return fIsConstant;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   124
    }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   125
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
     * [schema default]
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
     * @return The canonical lexical representation of the declaration's {value constraint} value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_default>XML Schema Part 1: Structures [schema default]</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
    public String getSchemaDefault() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
        return fDeclaration == null ? null : fDeclaration.getConstraintValue();
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
     * [schema normalized value]
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_normalized_value>XML Schema Part 1: Structures [schema normalized value]</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
     * @return the normalized value of this item after validation
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
    public String getSchemaNormalizedValue() {
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   144
        return fValue.getNormalizedValue();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     * [schema specified]
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
     * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_specified">XML Schema Part 1: Structures [schema specified]</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
     * @return true - value was specified in schema, false - value comes from the infoset
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
    public boolean getIsSchemaSpecified() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
        return fSpecified;
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
     * Determines the extent to which the document has been validated
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
     * @return return the [validation attempted] property. The possible values are
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
     *         NO_VALIDATION, PARTIAL_VALIDATION and FULL_VALIDATION
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
    public short getValidationAttempted() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
        return fValidationAttempted;
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
     * Determine the validity of the node with respect
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
     * to the validation being attempted
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
     * @return return the [validity] property. Possible values are:
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
     *         UNKNOWN_VALIDITY, INVALID_VALIDITY, VALID_VALIDITY
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
    public short getValidity() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
        return fValidity;
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
     * A list of error codes generated from validation attempts.
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
     * Need to find all the possible subclause reports that need reporting
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
     * @return list of error codes
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
    public StringList getErrorCodes() {
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   185
        if (fErrors == null || fErrors.length == 0) {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   186
            return StringListImpl.EMPTY_LIST;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   187
        }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   188
        return new PSVIErrorList(fErrors, true);
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   189
    }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   190
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   191
    /**
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   192
     * A list of error messages generated from the validation attempt or
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   193
     * an empty <code>StringList</code> if no errors occurred during the
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   194
     * validation attempt. The indices of error messages in this list are
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   195
     * aligned with those in the <code>[schema error code]</code> list.
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   196
     */
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   197
    public StringList getErrorMessages() {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   198
        if (fErrors == null || fErrors.length == 0) {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   199
            return StringListImpl.EMPTY_LIST;
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   200
        }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   201
        return new PSVIErrorList(fErrors, false);
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
    // This is the only information we can provide in a pipeline.
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
    public String getValidationContext() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
        return fValidationContext;
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
     * An item isomorphic to the type definition used to validate this element.
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
     * @return  a type declaration
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
    public XSTypeDefinition getTypeDefinition() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
        return fTypeDecl;
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
     * If and only if that type definition is a simple type definition
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
     * with {variety} union, or a complex type definition whose {content type}
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
     * is a simple thype definition with {variety} union, then an item isomorphic
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
     * to that member of the union's {member type definitions} which actually
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
     * validated the element item's normalized value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
     * @return  a simple type declaration
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
    public XSSimpleTypeDefinition getMemberTypeDefinition() {
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   228
        return fValue.getMemberTypeDefinition();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
     * An item isomorphic to the attribute declaration used to validate
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
     * this attribute.
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
     * @return  an attribute declaration
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
    public XSAttributeDeclaration getAttributeDeclaration() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
        return fDeclaration;
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
    /* (non-Javadoc)
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
     * @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValue()
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
    public Object getActualNormalizedValue() {
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   245
        return fValue.getActualValue();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
    /* (non-Javadoc)
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
     * @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getActualNormalizedValueType()
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
    public short getActualNormalizedValueType() {
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   252
        return fValue.getActualValueType();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
    /* (non-Javadoc)
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
     * @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getItemValueTypes()
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
    public ShortList getItemValueTypes() {
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   259
        return fValue.getListValueTypes();
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   260
    }
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   261
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   262
    /* (non-Javadoc)
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   263
     * @see com.sun.org.apache.xerces.internal.xs.ItemPSVI#getSchemaValue()
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   264
     */
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   265
    public XSValue getSchemaValue() {
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   266
        return fValue;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
     * Reset()
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
    public void reset() {
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   273
        fValue.reset();
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
        fDeclaration = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
        fTypeDecl = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
        fSpecified = false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
        fValidationAttempted = AttributePSVI.VALIDATION_NONE;
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
        fValidity = AttributePSVI.VALIDITY_NOTKNOWN;
27111
7a491d709b83 8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents: 25868
diff changeset
   279
        fErrors = null;
6
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
        fValidationContext = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
}