KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > xni > grammars > XMLGrammarLoader


1 /*
2  * Copyright 2000-2002,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.xni.grammars;
18
19 import org.apache.xerces.xni.parser.XMLConfigurationException;
20 import org.apache.xerces.xni.parser.XMLErrorHandler;
21 import org.apache.xerces.xni.parser.XMLEntityResolver;
22 import org.apache.xerces.xni.parser.XMLInputSource;
23 import org.apache.xerces.xni.XNIException;
24
25 import java.io.IOException JavaDoc;
26 import java.util.Locale JavaDoc;
27
28 /**
29  * The intention of this interface is to provide a generic means
30  * by which Grammar objects may be created without parsing instance
31  * documents. Implementations of this interface will know how to load
32  * specific types of grammars (e.g., DTD's or schemas); a wrapper
33  * will be provided for user applications to interact with these implementations.
34  *
35  * @author Neil Graham, IBM
36  * @version $Id: XMLGrammarLoader.java,v 1.2 2004/02/24 23:15:58 mrglavas Exp $
37  */

38
39 public interface XMLGrammarLoader {
40
41     /**
42      * Returns a list of feature identifiers that are recognized by
43      * this XMLGrammarLoader. This method may return null if no features
44      * are recognized.
45      */

46     public String JavaDoc[] getRecognizedFeatures();
47
48     /**
49      * Returns the state of a feature.
50      *
51      * @param featureId The feature identifier.
52      *
53      * @throws XMLConfigurationException Thrown on configuration error.
54      */

55     public boolean getFeature(String JavaDoc featureId)
56             throws XMLConfigurationException;
57
58     /**
59      * Sets the state of a feature.
60      *
61      * @param featureId The feature identifier.
62      * @param state The state of the feature.
63      *
64      * @throws XMLConfigurationException Thrown when a feature is not
65      * recognized or cannot be set.
66      */

67     public void setFeature(String JavaDoc featureId,
68                 boolean state) throws XMLConfigurationException;
69
70     /**
71      * Returns a list of property identifiers that are recognized by
72      * this XMLGrammarLoader. This method may return null if no properties
73      * are recognized.
74      */

75     public String JavaDoc[] getRecognizedProperties();
76
77     /**
78      * Returns the state of a property.
79      *
80      * @param propertyId The property identifier.
81      *
82      * @throws XMLConfigurationException Thrown on configuration error.
83      */

84     public Object JavaDoc getProperty(String JavaDoc propertyId)
85             throws XMLConfigurationException;
86
87     /**
88      * Sets the state of a property.
89      *
90      * @param propertyId The property identifier.
91      * @param state The state of the property.
92      *
93      * @throws XMLConfigurationException Thrown when a property is not
94      * recognized or cannot be set.
95      */

96     public void setProperty(String JavaDoc propertyId,
97                 Object JavaDoc state) throws XMLConfigurationException;
98
99     /**
100      * Set the locale to use for messages.
101      *
102      * @param locale The locale object to use for localization of messages.
103      *
104      * @exception XNIException Thrown if the parser does not support the
105      * specified locale.
106      */

107     public void setLocale(Locale JavaDoc locale);
108
109     /** Return the Locale the XMLGrammarLoader is using. */
110     public Locale JavaDoc getLocale();
111
112     /**
113      * Sets the error handler.
114      *
115      * @param errorHandler The error handler.
116      */

117     public void setErrorHandler(XMLErrorHandler errorHandler);
118
119     /** Returns the registered error handler. */
120     public XMLErrorHandler getErrorHandler();
121
122     /**
123      * Sets the entity resolver.
124      *
125      * @param entityResolver The new entity resolver.
126      */

127     public void setEntityResolver(XMLEntityResolver entityResolver);
128
129     /** Returns the registered entity resolver. */
130     public XMLEntityResolver getEntityResolver();
131
132     /**
133      * Returns a Grammar object by parsing the contents of the
134      * entity pointed to by source.
135      *
136      * @param source the location of the entity which forms
137      * the starting point of the grammar to be constructed.
138      * @throws IOException When a problem is encountered reading the entity
139      * XNIException When a condition arises (such as a FatalError) that requires parsing
140      * of the entity be terminated.
141      */

142     public Grammar loadGrammar(XMLInputSource source)
143         throws IOException JavaDoc, XNIException;
144 } // XMLGrammarLoader
145

146
Popular Tags