|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Validator
The Validator
interface provides the abstraction of a component able
to validate XML documents using schemas defined in different languages.
This is basically the main entry point of the validation API, allowing users
to transparently access validators (in the form of ValidationHandler
s
receiving SAX events for the documents to be validated), in different grammar
languages, using different implementations.
As more than one SchemaParser
might be able to parse and create
Schema
instances for a particular grammar language, this interface
defines a unique lookup method to allow selection of a particular
SchemaParser
implementation.
Assuming that two different SchemaParser
s called first
and second
are both able to understand the
RELAX NG
grammar (identified by the
http://relaxng.org/ns/structure/1.0
identifier) one could select
between the two implementation using the following two strings:
first:http://relaxng.org/ns/structure/1.0
second:http://relaxng.org/ns/structure/1.0
As a rule (unless when this is impossible) the grammar identifier is equivalent to the namespace of the root element of a schema.
Field Summary | |
---|---|
static String |
GRAMMAR_ISO_SCHEMATRON
The ISO Schematron grammar identifer. |
static String |
GRAMMAR_RELAX_CORE
The RELAX Core grammar identifer. |
static String |
GRAMMAR_RELAX_NG
The RELAX NG grammar identifer. |
static String |
GRAMMAR_RELAX_NS
The RELAX Namespace grammar identifer. |
static String |
GRAMMAR_SCHEMATRON
The Schematron grammar identifer. |
static String |
GRAMMAR_TREX
The Trex grammar identifer. |
static String |
GRAMMAR_XML_DTD
The XML DTD grammar identifer. |
static String |
GRAMMAR_XML_SCHEMA
The XML Schema grammar identifer. |
static String |
ROLE
Avalon Role name of Validator components. |
Method Summary | |
---|---|
ValidationHandler |
getValidationHandler(Source source)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
ValidationHandler |
getValidationHandler(Source source,
ErrorHandler errorHandler)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
ValidationHandler |
getValidationHandler(Source source,
String grammar)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
ValidationHandler |
getValidationHandler(Source source,
String grammar,
ErrorHandler errorHandler)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
ValidationHandler |
getValidationHandler(String uri)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
ValidationHandler |
getValidationHandler(String uri,
ErrorHandler errorHandler)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
ValidationHandler |
getValidationHandler(String uri,
String grammar)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
ValidationHandler |
getValidationHandler(String uri,
String grammar,
ErrorHandler errorHandler)
Return a ValidationHandler validating an XML document according to
the schema found at the specified location. |
Field Detail |
---|
static final String ROLE
Avalon Role name of Validator
components.
static final String GRAMMAR_ISO_SCHEMATRON
The ISO Schematron grammar identifer.
static final String GRAMMAR_RELAX_NG
The RELAX NG grammar identifer.
static final String GRAMMAR_RELAX_CORE
The RELAX Core grammar identifer.
static final String GRAMMAR_RELAX_NS
The RELAX Namespace grammar identifer.
static final String GRAMMAR_SCHEMATRON
The Schematron grammar identifer.
static final String GRAMMAR_TREX
The Trex grammar identifer.
static final String GRAMMAR_XML_SCHEMA
The XML Schema grammar identifer.
static final String GRAMMAR_XML_DTD
The XML DTD grammar identifer.
Method Detail |
---|
ValidationHandler getValidationHandler(String uri) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
The Validator
will attempt to automatically detect the grammar
language of the specified schema, and each error or warning occurring while
validating the document will trigger a SAXException
to be thrown back
to the caller.
uri
- the location of the schema to use to validate the document.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the grammar language of the specified schema
could not be detected or was not supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
ValidationHandler getValidationHandler(String uri, String grammar) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
Each error or warning occurring while validating the document will trigger
a SAXException
to be thrown back to the caller.
uri
- the location of the schema to use to validate the document.grammar
- the grammar language of the schema to parse.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the specified grammar language wasn't supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
ValidationHandler getValidationHandler(String uri, ErrorHandler errorHandler) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
The Validator
will attempt to automatically detect the grammar
language of the specified schema, while each validation error or warning will
be passed to the specified ErrorHandler
which will have the ability
to generate and throw a SAXException
back to the caller.
uri
- the location of the schema to use to validate the document.errorHandler
- the ErrorHandler
notified of validation problems.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the grammar language of the specified schema
could not be detected or was not supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
ValidationHandler getValidationHandler(String uri, String grammar, ErrorHandler errorHandler) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
Each validation error or warning will be passed to the specified
ErrorHandler
which will have the ability to generate and throw a
SAXException
back to the caller.
uri
- the location of the schema to use to validate the document.grammar
- the grammar language of the schema to parse.errorHandler
- the ErrorHandler
notified of validation problems.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the specified grammar language wasn't supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
ValidationHandler getValidationHandler(Source source) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
The Validator
will attempt to automatically detect the grammar
language of the specified schema, and each error or warning occurring while
validating the document will trigger a SAXException
to be thrown back
to the caller.
source
- the Source
identifying the schema to use for validation.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the grammar language of the specified schema
could not be detected or was not supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
ValidationHandler getValidationHandler(Source source, String grammar) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
Each error or warning occurring while validating the document will trigger
a SAXException
to be thrown back to the caller.
source
- the Source
identifying the schema to use for validation.grammar
- the grammar language of the schema to parse.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the specified grammar language wasn't supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
ValidationHandler getValidationHandler(Source source, ErrorHandler errorHandler) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
The Validator
will attempt to automatically detect the grammar
language of the specified schema, while each validation error or warning will
be passed to the specified ErrorHandler
which will have the ability
to generate and throw a SAXException
back to the caller.
source
- the Source
identifying the schema to use for validation.errorHandler
- the ErrorHandler
notified of validation problems.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the grammar language of the specified schema
could not be detected or was not supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
ValidationHandler getValidationHandler(Source source, String grammar, ErrorHandler errorHandler) throws IOException, SAXException, ValidatorException
Return a ValidationHandler
validating an XML document according to
the schema found at the specified location.
Each validation error or warning will be passed to the specified
ErrorHandler
which will have the ability to generate and throw a
SAXException
back to the caller.
source
- the Source
identifying the schema to use for validation.grammar
- the grammar language of the schema to parse.errorHandler
- the ErrorHandler
notified of validation problems.
ValidationHandler
able to SAX events from
the original XML document to validate.
IOException
- if an I/O error occurred parsing the schema.
SAXException
- if a grammar error occurred parsing the schema.
ValidatorException
- if the specified grammar language wasn't supported.SchemaParser.parseSchema(Source, String)
,
Schema.createValidator(ErrorHandler)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |