1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22package com.sun.org.apache.xerces.internal.xs;
23
24/**
25 *  Represents an abstract PSVI item for an element or an attribute
26 * information item.
27 */
28public interface ItemPSVI {
29    /**
30     * Validity value indicating that validation has either not been performed
31     * or that a strict assessment of validity could not be performed.
32     */
33    public static final short VALIDITY_NOTKNOWN         = 0;
34    /**
35     * Validity value indicating that validation has been strictly assessed
36     * and the item in question is invalid according to the rules of schema
37     * validation.
38     */
39    public static final short VALIDITY_INVALID          = 1;
40    /**
41     * Validation status indicating that schema validation has been performed
42     * and the item in question is valid according to the rules of schema
43     * validation.
44     */
45    public static final short VALIDITY_VALID            = 2;
46    /**
47     * Validation status indicating that schema validation has been performed
48     * and the item in question has specifically been skipped.
49     */
50    public static final short VALIDATION_NONE           = 0;
51    /**
52     * Validation status indicating that schema validation has been performed
53     * on the item in question under the rules of lax validation.
54     */
55    public static final short VALIDATION_PARTIAL        = 1;
56    /**
57     * Validation status indicating that full schema validation has been
58     * performed on the item.
59     */
60    public static final short VALIDATION_FULL           = 2;
61
62    /**
63     * Returns a reference to an immutable instance with the same data
64     * that this instance of <code>ItemPSVI</code> currently has.
65     */
66    public ItemPSVI constant();
67
68    /**
69     * Returns <code>true</code> if this specific instance of
70     * <code>ItemPSVI</code> is immutable, otherwise <code>false</code>.
71     */
72    public boolean isConstant();
73
74    /**
75     * The nearest ancestor element information item with a
76     * <code>[schema information]</code> property (or this element item
77     * itself if it has such a property). For more information refer to
78     * element validation context and attribute validation context .
79     */
80    public String getValidationContext();
81
82    /**
83     * <code>[validity]</code>: determines the validity of the schema item
84     * with respect to the validation being attempted. The value will be one
85     * of the constants: <code>VALIDITY_NOTKNOWN</code>,
86     * <code>VALIDITY_INVALID</code> or <code>VALIDITY_VALID</code>.
87     */
88    public short getValidity();
89
90    /**
91     * <code>[validation attempted]</code>: determines the extent to which
92     * the schema item has been validated. The value will be one of the
93     * constants: <code>VALIDATION_NONE</code>,
94     * <code>VALIDATION_PARTIAL</code> or <code>VALIDATION_FULL</code>.
95     */
96    public short getValidationAttempted();
97
98    /**
99     * <code>[schema error code]</code>: a list of error codes generated from
100     * the validation attempt or an empty <code>StringList</code> if no
101     * errors occurred during the validation attempt.
102     */
103    public StringList getErrorCodes();
104
105    /**
106     * A list of error messages generated from the validation attempt or
107     * an empty <code>StringList</code> if no errors occurred during the
108     * validation attempt. The indices of error messages in this list are
109     * aligned with those in the <code>[schema error code]</code> list.
110     */
111    public StringList getErrorMessages();
112
113    /**
114     * <code>[schema normalized value]</code>: the normalized value of this
115     * item after validation.
116     *
117     * @deprecated Use getSchemaValue().getNormalizedValue() instead
118     */
119    public String getSchemaNormalizedValue();
120
121    /**
122     * <code>[schema normalized value]</code>: Binding specific actual value
123     * or <code>null</code> if the value is in error.
124     * @exception XSException
125     *   NOT_SUPPORTED_ERR: Raised if the implementation does not support this
126     *   method.
127     *
128     * @deprecated Use getSchemaValue().getActualValue() instead
129     */
130    public Object getActualNormalizedValue()
131                                   throws XSException;
132
133    /**
134     * The actual value built-in datatype, e.g.
135     * <code>STRING_DT, SHORT_DT</code>. If the type definition of this
136     * value is a list type definition, this method returns
137     * <code>LIST_DT</code>. If the type definition of this value is a list
138     * type definition whose item type is a union type definition, this
139     * method returns <code>LISTOFUNION_DT</code>. To query the actual value
140     * of the list or list of union type definitions use
141     * <code>itemValueTypes</code>. If the <code>actualNormalizedValue</code>
142     *  is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>.
143     * @exception XSException
144     *   NOT_SUPPORTED_ERR: Raised if the implementation does not support this
145     *   method.
146     *
147     *  @deprecated Use getSchemaValue().getActualValueType() instead
148     */
149    public short getActualNormalizedValueType()
150                                   throws XSException;
151
152    /**
153     * In the case the actual value represents a list, i.e. the
154     * <code>actualNormalizedValueType</code> is <code>LIST_DT</code>, the
155     * returned array consists of one type kind which represents the itemType
156     * . For example:
157     * <pre> &lt;simpleType name="listtype"&gt; &lt;list
158     * itemType="positiveInteger"/&gt; &lt;/simpleType&gt; &lt;element
159     * name="list" type="listtype"/&gt; ... &lt;list&gt;1 2 3&lt;/list&gt; </pre>
160     *
161     * The <code>schemaNormalizedValue</code> value is "1 2 3", the
162     * <code>actualNormalizedValueType</code> value is <code>LIST_DT</code>,
163     * and the <code>itemValueTypes</code> is an array of size 1 with the
164     * value <code>POSITIVEINTEGER_DT</code>.
165     * <br> If the actual value represents a list type definition whose item
166     * type is a union type definition, i.e. <code>LISTOFUNION_DT</code>,
167     * for each actual value in the list the array contains the
168     * corresponding memberType kind. For example:
169     * <pre> &lt;simpleType
170     * name='union_type' memberTypes="integer string"/&gt; &lt;simpleType
171     * name='listOfUnion'&gt; &lt;list itemType='union_type'/&gt;
172     * &lt;/simpleType&gt; &lt;element name="list" type="listOfUnion"/&gt;
173     * ... &lt;list&gt;1 2 foo&lt;/list&gt; </pre>
174     *  The
175     * <code>schemaNormalizedValue</code> value is "1 2 foo", the
176     * <code>actualNormalizedValueType</code> is <code>LISTOFUNION_DT</code>
177     * , and the <code>itemValueTypes</code> is an array of size 3 with the
178     * following values: <code>INTEGER_DT, INTEGER_DT, STRING_DT</code>.
179     * @exception XSException
180     *   NOT_SUPPORTED_ERR: Raised if the implementation does not support this
181     *   method.
182     *
183     *  @deprecated Use getSchemaValue().getListValueTypes() instead
184     */
185    public ShortList getItemValueTypes()
186                                   throws XSException;
187
188    /**
189     * If this item has a simple type definition or a complex type with simple
190     * content, then return the value with respect to the simple type. If
191     * this item doesn't have a simple-typed value, the behavior of this method
192     * is not specified.
193     */
194    public XSValue getSchemaValue();
195
196    /**
197     * <code>[type definition]</code>: an item isomorphic to the type
198     * definition used to validate the schema item.
199     */
200    public XSTypeDefinition getTypeDefinition();
201
202    /**
203     * <code>[member type definition]</code>: if and only if that type
204     * definition is a simple type definition with {variety} union, or a
205     * complex type definition whose {content type} is a simple type
206     * definition with {variety} union, then an item isomorphic to that
207     * member of the union's {member type definitions} which actually
208     * validated the schema item's normalized value.
209     */
210    public XSSimpleTypeDefinition getMemberTypeDefinition();
211
212    /**
213     * <code>[schema default]</code>: the canonical lexical representation of
214     * the declaration's {value constraint} value. For more information
215     * refer to element schema default and attribute schema default.
216     */
217    public String getSchemaDefault();
218
219    /**
220     * <code>[schema specified]</code>: if true, the value was specified in
221     * the schema. If false, the value comes from the infoset. For more
222     * information refer to element specified and attribute specified.
223     */
224    public boolean getIsSchemaSpecified();
225
226}
227