1 /* 2 * Copyright 2003,2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.apache.xerces.xs; 18 19 /** 20 * This interface provides access to the post schema validation infoset for an 21 * API that provides a streaming document infoset, such as SAX, XNI, and 22 * others. 23 * <p>For implementations that would like to provide access to the PSVI in a 24 * streaming model, a parser object should also implement the 25 * <code>PSVIProvider</code> interface. Within the scope of the methods 26 * handling the start and end of an element, applications may use the 27 * <code>PSVIProvider</code> to retrieve the PSVI related to the element and 28 * its attributes. 29 */ 30 public interface PSVIProvider { 31 /** 32 * Provides the post schema validation item for the current element 33 * information item. The method must be called by an application while 34 * in the scope of the methods which report the start and end of an 35 * element. For example, for SAX the method must be called within the 36 * scope of the document handler's <code>startElement</code> or 37 * <code>endElement</code> call. If the method is called outside of the 38 * specified scope, the return value is undefined. 39 * @return The post schema validation infoset for the current element. If 40 * an element information item is valid, then in the 41 * post-schema-validation infoset the following properties must be 42 * available for the element information item: The following 43 * properties are available in the scope of the method that reports 44 * the start of an element: {element declaration}, {validation 45 * context}, {notation}. The {schema information} property is 46 * available for the validation root. The {error codes} property is 47 * available if any errors occured during validation. The following 48 * properties are available in the scope of the method that reports 49 * the end of an element: {nil}, {schema specified}, {normalized 50 * value},{ member type definition}, {validity}, {validation attempted} 51 * . If the declaration has a value constraint, the property {schema 52 * default} is available. The {error codes} property is available if 53 * any errors occured during validation. Note: some processors may 54 * choose to provide all the PSVI properties in the scope of the 55 * method that reports the end of an element. 56 */ 57 public ElementPSVI getElementPSVI(); 58 59 /** 60 * Provides <code>AttributePSVI</code> given the index of an attribute 61 * information item in the current element's attribute list. The method 62 * must be called by an application while in the scope of the methods 63 * which report the start and end of an element at a point where the 64 * attribute list is available. For example, for SAX the method must be 65 * called while in the scope of the document handler's 66 * <code>startElement</code> call. If the method is called outside of 67 * the specified scope, the return value is undefined. 68 * @param index The attribute index. 69 * @return The post schema validation properties of the attribute. 70 */ 71 public AttributePSVI getAttributePSVI(int index); 72 73 /** 74 * Provides <code>AttributePSVI</code> given the namespace name and the 75 * local name of an attribute information item in the current element's 76 * attribute list. The method must be called by an application while in 77 * the scope of the methods which report the start and end of an element 78 * at a point where the attribute list is available. For example, for 79 * SAX the method must be called while in the scope of the document 80 * handler's <code>startElement</code> call. If the method is called 81 * outside of the specified scope, the return value is undefined. 82 * @param uri The namespace name of an attribute. 83 * @param localname The local name of an attribute. 84 * @return The post schema validation properties of the attribute. 85 */ 86 public AttributePSVI getAttributePSVIByName(String uri, 87 String localname); 88 89 } 90