org.apache.cocoon.components.validation
Interface SchemaParser

All Known Implementing Classes:
AbstractSchemaParser, JaxpSchemaParser, JingSchemaParser

public interface SchemaParser

The SchemaParser interface defines the abstraction of a component able to parse sources and produce Schema instances suitable for validation of XML documents.

A SchemaParser might be able to understand more than one grammar language at the same time. The list of all supported grammar languages must be returned by the getSupportedGrammars() method.


Field Summary
static String ROLE
          Avalon Role name of SchemaParser components.
 
Method Summary
 String[] getSupportedGrammars()
          Return an array of Strings containing all the grammar languages supported by this SchemaParser.
 Schema parseSchema(Source source, String grammar)
          Parse the specified Source and return a new Schema.
 

Field Detail

ROLE

static final String ROLE

Avalon Role name of SchemaParser components.

Method Detail

parseSchema

Schema parseSchema(Source source,
                   String grammar)
                   throws SAXException,
                          IOException,
                          IllegalArgumentException

Parse the specified Source and return a new Schema.

The returned Schema must be able to validate multiple documents via multiple invocations of Schema.createValidator(ErrorHandler).

Parameters:
source - the Source associated with the Schema to return.
Returns:
a non-null Schema instance.
Throws:
SAXException - if a grammar error occurred parsing the schema.
IOException - if an I/O error occurred parsing the schema.
IllegalArgumentException - if the specified grammar type is not one of the grammar types returned by the getSupportedGrammars() method.

getSupportedGrammars

String[] getSupportedGrammars()

Return an array of Strings containing all the grammar languages supported by this SchemaParser.

Returns:
a non-null array of Strings.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.