com.thaiopensource.relaxng
Interface ValidatorHandler

All Superinterfaces:
ContentHandler, DTDHandler

public interface ValidatorHandler
extends ContentHandler, DTDHandler

A SAX 2 content handler that validates the content it receives. A ValidatorHandler is not safe for concurrent access for multiple threads. A single ValidatorHandler can be used to validate only a single document at a time. It can be used to validate a sequence of documents by calling reset between documents. If multiple documents must be validated concurrently, then a separate ValidatorHandler must be used for each document. ValidatorHandler extends DTDHandler so that validation can have access to information about the DTD, specifically the unparsed entities and notations.

Author:
James Clark

Method Summary
 ErrorHandler getErrorHandler()
          Returns the current ErrorHandler as set by setErrorHandler.
 boolean isComplete()
          Reports whether the complete document has been received, that is, whether endDocument has been called.
 boolean isValidSoFar()
          Reports whether the content received so far is valid.
 void reset()
          Prepares to receive the content of another document.
 void setErrorHandler(ErrorHandler eh)
          Sets the current ErrorHandler to be used for reporting validation errors.
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.DTDHandler
notationDecl, unparsedEntityDecl
 

Method Detail

isValidSoFar

public boolean isValidSoFar()
Reports whether the content received so far is valid. If this is called before endDocument, then it reports whether the content received so far is such that subsequent content may result in a valid document. If this is called after endDocument, then it reports whether the content received constitutes a valid document.

Returns:
true if the content is valid; false otherwise.

isComplete

public boolean isComplete()
Reports whether the complete document has been received, that is, whether endDocument has been called.

Returns:
true if the complete document has been received; false otherwise.

reset

public void reset()
Prepares to receive the content of another document. Immediately after reset is called isValidSoFar will return true and isComplete will return false. The current ErrorHandler is not affected.


setErrorHandler

public void setErrorHandler(ErrorHandler eh)
Sets the current ErrorHandler to be used for reporting validation errors. This may be called at any time, even after this ValidatorHandler has started to received content.

Parameters:
eh - the error handler to use for reporting errors; null if errors should not be reported
See Also:
getErrorHandler()

getErrorHandler

public ErrorHandler getErrorHandler()
Returns the current ErrorHandler as set by setErrorHandler.

Returns:
the current ErrorHandler; maybe null if no ErrorHandler has been set.
See Also:
setErrorHandler(org.xml.sax.ErrorHandler)