286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 2000-2002,2004 The Apache Software Foundation.
286N/A *
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 *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
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 */
286N/A
286N/Apackage com.sun.org.apache.xerces.internal.xni.grammars;
286N/A
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
286N/Aimport com.sun.org.apache.xerces.internal.xni.XNIException;
286N/A
286N/Aimport java.io.IOException;
286N/Aimport java.util.Locale;
286N/A
286N/A/**
286N/A * The intention of this interface is to provide a generic means
286N/A * by which Grammar objects may be created without parsing instance
286N/A * documents. Implementations of this interface will know how to load
286N/A * specific types of grammars (e.g., DTD's or schemas); a wrapper
286N/A * will be provided for user applications to interact with these implementations.
286N/A *
286N/A * @author Neil Graham, IBM
286N/A */
286N/A
286N/Apublic interface XMLGrammarLoader {
286N/A
286N/A /**
286N/A * Returns a list of feature identifiers that are recognized by
286N/A * this XMLGrammarLoader. This method may return null if no features
286N/A * are recognized.
286N/A */
286N/A public String[] getRecognizedFeatures();
286N/A
286N/A /**
286N/A * Returns the state of a feature.
286N/A *
286N/A * @param featureId The feature identifier.
286N/A *
286N/A * @throws XMLConfigurationException Thrown on configuration error.
286N/A */
286N/A public boolean getFeature(String featureId)
286N/A throws XMLConfigurationException;
286N/A
286N/A /**
286N/A * Sets the state of a feature.
286N/A *
286N/A * @param featureId The feature identifier.
286N/A * @param state The state of the feature.
286N/A *
286N/A * @throws XMLConfigurationException Thrown when a feature is not
286N/A * recognized or cannot be set.
286N/A */
286N/A public void setFeature(String featureId,
286N/A boolean state) throws XMLConfigurationException;
286N/A
286N/A /**
286N/A * Returns a list of property identifiers that are recognized by
286N/A * this XMLGrammarLoader. This method may return null if no properties
286N/A * are recognized.
286N/A */
286N/A public String[] getRecognizedProperties();
286N/A
286N/A /**
286N/A * Returns the state of a property.
286N/A *
286N/A * @param propertyId The property identifier.
286N/A *
286N/A * @throws XMLConfigurationException Thrown on configuration error.
286N/A */
286N/A public Object getProperty(String propertyId)
286N/A throws XMLConfigurationException;
286N/A
286N/A /**
286N/A * Sets the state of a property.
286N/A *
286N/A * @param propertyId The property identifier.
286N/A * @param state The state of the property.
286N/A *
286N/A * @throws XMLConfigurationException Thrown when a property is not
286N/A * recognized or cannot be set.
286N/A */
286N/A public void setProperty(String propertyId,
286N/A Object state) throws XMLConfigurationException;
286N/A
286N/A /**
286N/A * Set the locale to use for messages.
286N/A *
286N/A * @param locale The locale object to use for localization of messages.
286N/A *
286N/A * @exception XNIException Thrown if the parser does not support the
286N/A * specified locale.
286N/A */
286N/A public void setLocale(Locale locale);
286N/A
286N/A /** Return the Locale the XMLGrammarLoader is using. */
286N/A public Locale getLocale();
286N/A
286N/A /**
286N/A * Sets the error handler.
286N/A *
286N/A * @param errorHandler The error handler.
286N/A */
286N/A public void setErrorHandler(XMLErrorHandler errorHandler);
286N/A
286N/A /** Returns the registered error handler. */
286N/A public XMLErrorHandler getErrorHandler();
286N/A
286N/A /**
286N/A * Sets the entity resolver.
286N/A *
286N/A * @param entityResolver The new entity resolver.
286N/A */
286N/A public void setEntityResolver(XMLEntityResolver entityResolver);
286N/A
286N/A /** Returns the registered entity resolver. */
286N/A public XMLEntityResolver getEntityResolver();
286N/A
286N/A /**
286N/A * Returns a Grammar object by parsing the contents of the
286N/A * entity pointed to by source.
286N/A *
286N/A * @param source the location of the entity which forms
286N/A * the starting point of the grammar to be constructed.
286N/A * @throws IOException When a problem is encountered reading the entity
286N/A * XNIException When a condition arises (such as a FatalError) that requires parsing
286N/A * of the entity be terminated.
286N/A */
286N/A public Grammar loadGrammar(XMLInputSource source)
286N/A throws IOException, XNIException;
286N/A} // XMLGrammarLoader