KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > validation > SchemaParser


1 /*
2  * Copyright 1999-2005 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 package org.apache.cocoon.components.validation;
17
18 import java.io.IOException JavaDoc;
19
20 import org.apache.excalibur.source.Source;
21 import org.xml.sax.ErrorHandler JavaDoc;
22 import org.xml.sax.SAXException JavaDoc;
23
24 /**
25  * <p>The {@link SchemaParser} interface defines the abstraction of a component able
26  * to parse sources and produce {@link Schema} instances suitable for validation of
27  * XML documents.</p>
28  *
29  * <p>A {@link SchemaParser} might be able to understand more than one grammar
30  * language at the same time. The list of all supported grammar languages must be
31  * returned by the {@link #getSupportedGrammars()} method.</p>
32  *
33  * @author <a HREF="mailto:pier@betaversion.org">Pier Fumagalli</a>
34  */

35 public interface SchemaParser {
36
37     /** <p>Avalon Role name of {@link SchemaParser} components.</p> */
38     public static final String JavaDoc ROLE = SchemaParser.class.getName();
39
40     /**
41      * <p>Parse the specified {@link Source} and return a new {@link Schema}.</p>
42      *
43      * <p>The returned {@link Schema} must be able to validate multiple documents
44      * via multiple invocations of {@link Schema#createValidator(ErrorHandler)}.</p>
45      *
46      * @param source the {@link Source} associated with the {@link Schema} to return.
47      * @return a <b>non-null</b> {@link Schema} instance.
48      * @throws SAXException if a grammar error occurred parsing the schema.
49      * @throws IOException if an I/O error occurred parsing the schema.
50      * @throws IllegalArgumentException if the specified grammar type is not one
51      * of the grammar types returned by the
52      * {@link #getSupportedGrammars()} method.
53      */

54     public Schema parseSchema(Source source, String JavaDoc grammar)
55     throws SAXException JavaDoc, IOException JavaDoc, IllegalArgumentException JavaDoc;
56
57     /**
58      * <p>Return an array of {@link String}s containing all the grammar languages
59      * supported by this {@link SchemaParser}.</p>
60      *
61      * @return a <b>non-null</b> array of {@link String}s.
62      */

63     public String JavaDoc[] getSupportedGrammars();
64
65 }
66
Popular Tags