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