Package org.codehaus.stax2.validation
Interface Validatable
- All Known Subinterfaces:
XMLStreamReader2
,XMLStreamWriter2
- All Known Implementing Classes:
DOMWrappingReader
,DOMWrappingWriter
,Stax2FilteredStreamReader
,Stax2ReaderAdapter
,Stax2ReaderImpl
,Stax2WriterAdapter
,Stax2WriterImpl
,StreamReader2Delegate
,StreamWriter2Delegate
public interface Validatable
Interface that defines API that Stax2 validation system exposes to the
applications. It is implemented by stream readers and writers.
Interface defines methods for starting and stopping validation against specific schemas, or validator instances, as well as method(s) for adding an optional custom problem handler.
-
Method Summary
Modifier and TypeMethodDescriptionMethod that application can call to define a custom handler for validation problems encountered during validation process.Method that can be called by application to stop validating output against a schema, for whichvalidateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
was called earlier.stopValidatingAgainst
(XMLValidator validator) Method that can be called by application to stop validating output using specified validator.validateAgainst
(XMLValidationSchema schema) Method that will construct aXMLValidator
instance from the given schema (unless a validator for that schema has already been added), initialize it if necessary, and make validatable object (reader, writer) call appropriate validation methods from this point on until the end of the document (that is, it's not scoped with sub-trees), or until validator is removed by an explicit call tostopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
.
-
Method Details
-
validateAgainst
Method that will construct aXMLValidator
instance from the given schema (unless a validator for that schema has already been added), initialize it if necessary, and make validatable object (reader, writer) call appropriate validation methods from this point on until the end of the document (that is, it's not scoped with sub-trees), or until validator is removed by an explicit call tostopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
.Note that while this method can be called at any point in output processing, validator instances are not required to be able to handle addition at other points than right before outputting the root element.
- Returns:
- Validator instance constructed, if validator was added, or null if a validator for the schema has already been constructed.
- Throws:
XMLStreamException
-
stopValidatingAgainst
Method that can be called by application to stop validating output against a schema, for whichvalidateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
was called earlier.- Returns:
- Validator instance created from the schema that was removed, if one was in use; null if no such schema in use.
- Throws:
XMLStreamException
-
stopValidatingAgainst
Method that can be called by application to stop validating output using specified validator. The validator passed should be an earlier return value for a call tovalidateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
.Note: the specified validator is compared for identity with validators in use, not for equality.
- Returns:
- Validator instance found (ie. argument
validator
) if it was being used for validating current document; null if not. - Throws:
XMLStreamException
-
setValidationProblemHandler
Method that application can call to define a custom handler for validation problems encountered during validation process.- Parameters:
h
- Handler to install, if non null; if null, indicates that the default (implementation-specific) handling should be used- Returns:
- Previously set validation problem handler, if any; null if none was set
-