org.apache.cocoon.components.validation
Interface Schema

All Known Implementing Classes:
AbstractSchema, JaxpSchema, JingSchema

public interface Schema

The Schema interface defines an abstraction of a schema usable to validate an XML document.

This interface is not tied to any specific validation grammar language such as the W3C XML Shema language or the RELAX-NG language.

Selection and use of specific schema grammar languages is performed through the use of the Validator interface.

Once returned by the SchemaParser, a Schema instance must be able to validate a number of XML documents: each time a document needs to be validated, a new ValidationHandler can be obtained invoking the createValidator(ErrorHandler) method. While validating an XML document, SAXExceptions should be thrown back to the caller only when the specified ErrorHandler is configured to do so.


Method Summary
 ValidationHandler createValidator(ErrorHandler handler)
          Return a new ValidationHandler instance that can be used to validate an XML document by sending SAX events to it.
 SourceValidity getValidity()
          Return the SourceValidity associated with this Schema.
 

Method Detail

getValidity

SourceValidity getValidity()

Return the SourceValidity associated with this Schema.

If the schema represented by this instance was parsed from several sources (through the use of inclusions or referencing to external entities, for example) the SourceValidity returned by this method must consider all of them when the SourceValidity.isValid() or the SourceValidity.isValid(SourceValidity) methods are called.

Returns:
a SourceValidity instance or null if not known.

createValidator

ValidationHandler createValidator(ErrorHandler handler)
                                  throws SAXException

Return a new ValidationHandler instance that can be used to validate an XML document by sending SAX events to it.

The specified ErrorHandler will be notified of all warnings or errors encountered validating the SAX events sent to the returned ValidationHandler, and must not be null.

The returned ValidationHandler can be used to validate only one XML document. To validate more than one document, this method should be called once for each document to validate.

Parameters:
handler - an ErrorHandler to notify of validation errors.
Returns:
a non-null ValidationHandler instance.
Throws:
SAXException - if an error occurred creating the validation handler.


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