public interface Validator
Validator
is created and cannot be
changed. The XML document is provided to the Validator
by calling methods of the ContentHandler
object returned
by getContentHandler
; the methods must be called in
the sequence specified by the ContentHandler
interface. If the getDTDHandler
method returns
a non-null object, then method calls must be made on it
reporting DTD information.
Any errors will be reported to the ErrorHandler
specified when the Validator
was created. If, after the
call to the endDocument
method, no errors have been
reported, then the XML document is valid.
A single Validator
object is not safe for
concurrent access from multiple threads. A single
ValidatorHandler
can be used to validate only a single
document at a time.
After completing validation of an XML document (i.e. after calling
the endDocument
on the ContentHandler
),
reset
can be called to allow validation of another
document. The reset
method may create new ContentHandler
and DTDHandler
objects or may simply reinitialize the
state of the existing objects. Therefore, getContentHandler
and getDTDHandler
must be called after reset
to retrieve the objects to which the XML document to be validated
must be provided.
Modifier and Type | Method and Description |
---|---|
ContentHandler |
getContentHandler()
Returns the ContentHandler that will receive the XML document.
|
DTDHandler |
getDTDHandler()
Returns a DTDHandler.
|
void |
reset()
Cleans up after validating a document.
|
ContentHandler getContentHandler()
reset
is called.null
reset()
DTDHandler getDTDHandler()
null
is returned. The same object will always be returned unless
reset
is called: this method does not change the state
of the Validator.null
if DTD information is
not significant to the Validator
void reset()
reset
must be called. After calling
reset(), another document may be validated. Calling this method
may create new ContentHandler and DTDHandler objects or may simply
reinitialize the state of the existing objects.