1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. *
  5. * Copyright (c) 2003 The Apache Software Foundation. All rights
  6. * reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. The end-user documentation included with the redistribution,
  21. * if any, must include the following acknowledgment:
  22. * "This product includes software developed by the
  23. * Apache Software Foundation (http://www.apache.org/)."
  24. * Alternately, this acknowledgment may appear in the software itself,
  25. * if and wherever such third-party acknowledgments normally appear.
  26. *
  27. * 4. The names "Xerces" and "Apache Software Foundation" must
  28. * not be used to endorse or promote products derived from this
  29. * software without prior written permission. For written
  30. * permission, please contact apache@apache.org.
  31. *
  32. * 5. Products derived from this software may not be called "Apache",
  33. * nor may "Apache" appear in their name, without prior written
  34. * permission of the Apache Software Foundation.
  35. *
  36. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. * SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This software consists of voluntary contributions made by many
  51. * individuals on behalf of the Apache Software Foundation and was
  52. * originally based on software copyright (c) 2003, International
  53. * Business Machines, Inc., http://www.apache.org. For more
  54. * information on the Apache Software Foundation, please see
  55. * <http://www.apache.org/>.
  56. */
  57. package com.sun.org.apache.xerces.internal.xs;
  58. /**
  59. * Represents an abstract PSVI item for an element or an attribute
  60. * information item.
  61. */
  62. public interface ItemPSVI {
  63. /**
  64. * Validity value indicating that validation has either not been performed
  65. * or that a strict assessment of validity could not be performed.
  66. */
  67. public static final short VALIDITY_NOTKNOWN = 0;
  68. /**
  69. * Validity value indicating that validation has been strictly assessed
  70. * and the item in question is invalid according to the rules of schema
  71. * validation.
  72. */
  73. public static final short VALIDITY_INVALID = 1;
  74. /**
  75. * Validation status indicating that schema validation has been performed
  76. * and the item in question is valid according to the rules of schema
  77. * validation.
  78. */
  79. public static final short VALIDITY_VALID = 2;
  80. /**
  81. * Validation status indicating that schema validation has been performed
  82. * and the item in question has specifically been skipped.
  83. */
  84. public static final short VALIDATION_NONE = 0;
  85. /**
  86. * Validation status indicating that schema validation has been performed
  87. * on the item in question under the rules of lax validation.
  88. */
  89. public static final short VALIDATION_PARTIAL = 1;
  90. /**
  91. * Validation status indicating that full schema validation has been
  92. * performed on the item.
  93. */
  94. public static final short VALIDATION_FULL = 2;
  95. /**
  96. * The nearest ancestor element information item with a
  97. * <code>[schema information]</code> property (or this element item
  98. * itself if it has such a property). For more information refer to
  99. * element validation context and attribute validation context .
  100. */
  101. public String getValidationContext();
  102. /**
  103. * <code>[validity]</code>: determines the validity of the schema item
  104. * with respect to the validation being attempted. The value will be one
  105. * of the constants: <code>VALIDITY_NOTKNOWN</code>,
  106. * <code>VALIDITY_INVALID</code> or <code>VALIDITY_VALID</code>.
  107. */
  108. public short getValidity();
  109. /**
  110. * <code>[validation attempted]</code>: determines the extent to which
  111. * the schema item has been validated. The value will be one of the
  112. * constants: <code>VALIDATION_NONE</code>,
  113. * <code>VALIDATION_PARTIAL</code> or <code>VALIDATION_FULL</code>.
  114. */
  115. public short getValidationAttempted();
  116. /**
  117. * <code>[schema error code]</code>: a list of error codes generated from
  118. * the validation attempt or an empty <code>StringList</code> if no
  119. * errors occurred during the validation attempt.
  120. */
  121. public StringList getErrorCodes();
  122. /**
  123. * <code>[schema normalized value]</code>: the normalized value of this
  124. * item after validation.
  125. */
  126. public String getSchemaNormalizedValue();
  127. /**
  128. * <code>[schema normalized value]</code>: Binding specific actual value
  129. * or <code>null</code> if the value is in error.
  130. * @exception XSException
  131. * NOT_SUPPORTED_ERR: Raised if the implementation does not support this
  132. * method.
  133. */
  134. public Object getActualNormalizedValue()
  135. throws XSException;
  136. /**
  137. * The actual value built-in datatype, e.g.
  138. * <code>STRING_DT, SHORT_DT</code>. If the type definition of this
  139. * value is a list type definition, this method returns
  140. * <code>LIST_DT</code>. If the type definition of this value is a list
  141. * type definition whose item type is a union type definition, this
  142. * method returns <code>LISTOFUNION_DT</code>. To query the actual value
  143. * of the list or list of union type definitions use
  144. * <code>itemValueTypes</code>. If the <code>actualNormalizedValue</code>
  145. * is <code>null</code>, this method returns <code>UNAVAILABLE_DT</code>
  146. * .
  147. * @exception XSException
  148. * NOT_SUPPORTED_ERR: Raised if the implementation does not support this
  149. * method.
  150. */
  151. public short getActualNormalizedValueType()
  152. throws XSException;
  153. /**
  154. * In the case the actual value represents a list, i.e. the
  155. * <code>actualNormalizedValueType</code> is <code>LIST_DT</code>, the
  156. * returned array consists of one type kind which represents the itemType
  157. * . For example:
  158. * <pre> <simpleType name="listtype"> <list
  159. * itemType="positiveInteger"/> </simpleType> <element
  160. * name="list" type="listtype"/> ... <list>1 2 3</list> </pre>
  161. *
  162. * The <code>schemaNormalizedValue</code> value is "1 2 3", the
  163. * <code>actualNormalizedValueType</code> value is <code>LIST_DT</code>,
  164. * and the <code>itemValueTypes</code> is an array of size 1 with the
  165. * value <code>POSITIVEINTEGER_DT</code>.
  166. * <br> If the actual value represents a list type definition whose item
  167. * type is a union type definition, i.e. <code>LISTOFUNION_DT</code>,
  168. * for each actual value in the list the array contains the
  169. * corresponding memberType kind. For example:
  170. * <pre> <simpleType
  171. * name='union_type' memberTypes="integer string"/> <simpleType
  172. * name='listOfUnion'> <list itemType='union_type'/>
  173. * </simpleType> <element name="list" type="listOfUnion"/>
  174. * ... <list>1 2 foo</list> </pre>
  175. * The
  176. * <code>schemaNormalizedValue</code> value is "1 2 foo", the
  177. * <code>actualNormalizedValueType</code> is <code>LISTOFUNION_DT</code>
  178. * , and the <code>itemValueTypes</code> is an array of size 3 with the
  179. * following values: <code>INTEGER_DT, INTEGER_DT, STRING_DT</code>.
  180. * @exception XSException
  181. * NOT_SUPPORTED_ERR: Raised if the implementation does not support this
  182. * method.
  183. */
  184. public ShortList getItemValueTypes()
  185. throws XSException;
  186. /**
  187. * <code>[type definition]</code>: an item isomorphic to the type
  188. * definition used to validate the schema item.
  189. */
  190. public XSTypeDefinition getTypeDefinition();
  191. /**
  192. * <code>[member type definition]</code>: if and only if that type
  193. * definition is a simple type definition with {variety} union, or a
  194. * complex type definition whose {content type} is a simple type
  195. * definition with {variety} union, then an item isomorphic to that
  196. * member of the union's {member type definitions} which actually
  197. * validated the schema item's normalized value.
  198. */
  199. public XSSimpleTypeDefinition getMemberTypeDefinition();
  200. /**
  201. * <code>[schema default]</code>: the canonical lexical representation of
  202. * the declaration's {value constraint} value. For more information
  203. * refer to element schema default and attribute schema default.
  204. */
  205. public String getSchemaDefault();
  206. /**
  207. * <code>[schema specified]</code>: if true, the value was specified in
  208. * the schema. If false, the value comes from the infoset. For more
  209. * information refer to element specified and attribute specified.
  210. */
  211. public boolean getIsSchemaSpecified();
  212. }