286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 2000-2002,2004 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * <p> This interface specifies how the parser and the application 286N/A * interact with respect to Grammar objects that the application 286N/A * possesses--either by having precompiled them or by having stored them 286N/A * from a previous validation of an instance document. It makes no 286N/A * assumptions about the kind of Grammar involved, or about how the 286N/A * application's storage mechanism works.</p> 286N/A * <p>The interaction works as follows: 286N/A * <li>When a validator considers a document, it is expected to request 286N/A * grammars of the type it can handle from this object using the 286N/A * <code>retrieveInitialGrammarSet</code> method. </li> 286N/A * <li>If it requires a grammar 286N/A * not in this set, it will request it from this Object using the 286N/A * <code>retrieveGrammar</code> method. </li> 286N/A * <li> After successfully validating an 286N/A * instance, the validator should make any new grammars it has compiled 286N/A * available to this object using the <code>cacheGrammars</code> 286N/A * method; for ease of implementation it may make other Grammars it holds references to as well (i.e., 286N/A * it may return some grammars that were retrieved from the GrammarPool in earlier operations). </li> </ul> </p> 286N/A * @author Neil Graham, IBM 286N/A // <p>we are trying to make this XMLGrammarPool work for all kinds of 286N/A // grammars, so we have a parameter "grammarType" for each of the 286N/A * <p> retrieve the initial known set of grammars. this method is 286N/A * called by a validator before the validation starts. the application 286N/A * can provide an initial set of grammars available to the current 286N/A * validation attempt. </p> 286N/A * @param grammarType the type of the grammar, from the 286N/A * <code>com.sun.org.apache.xerces.internal.xni.grammars.Grammar</code> interface. 286N/A * @return the set of grammars the validator may put in its "bucket" 286N/A * <p>return the final set of grammars that the validator ended up 286N/A * This method is called after the 286N/A * validation finishes. The application may then choose to cache some 286N/A * of the returned grammars. </p> 286N/A * @param grammarType the type of the grammars being returned; 286N/A * @param grammars an array containing the set of grammars being 286N/A * returned; order is not significant. 286N/A * <p> This method requests that the application retrieve a grammar 286N/A * corresponding to the given GrammarIdentifier from its cache. 286N/A * If it cannot do so it must return null; the parser will then 286N/A * call the EntityResolver. <strong>An application must not call its 286N/A * EntityResolver itself from this method; this may result in infinite 286N/A * @param desc The description of the Grammar being requested. 286N/A * @return the Grammar corresponding to this description or null if 286N/A * no such Grammar is known. 286N/A * Causes the XMLGrammarPool not to store any grammars when 286N/A * the cacheGrammars(String, Grammar[[]) method is called. 286N/A * Allows the XMLGrammarPool to store grammars when its cacheGrammars(String, Grammar[]) 286N/A * method is called. This is the default state of the object. 286N/A * Removes all grammars from the pool.