Interface Verifier
- All Known Implementing Classes:
VerifierImpl
An instance of this interface can be obtained through the
VerifierFactory.newVerifier(java.lang.String) method or
Schema.newVerifier() method.
Once it is created, an application can use one instance to validate
multiple documents.
This interface is not thread-safe and not reentrant. That is, only one thread can use it at any given time, and you can only validate one document at any given time.
- Since:
- Feb. 23, 2001
- Version:
- Mar. 4, 2001
- Author:
- ASAMI, Tomoharu (asami@zeomtech.com), Kohsuke KAWAGUCHI
-
Method Summary
Modifier and TypeMethodDescriptiongetProperty(String property) Gets a property valueGets a VerifierFilter.Gets a VerifierHandler.booleanChecks whether a feature is supported or not.voidsetEntityResolver(EntityResolver handler) Sets aEntityResolverto resolve external entity locations.voidsetErrorHandler(ErrorHandler handler) Sets aErrorHandlerthat receives validation errors/warnings.voidsetFeature(String feature, boolean value) Sets a value to a feature.voidsetProperty(String property, Object value) Sets a property valuebooleanvalidates an XML document.booleanvalidates an XML document.booleanvalidates an XML document.booleanverify(InputSource source) validates an XML document.
-
Method Details
-
isFeature
Checks whether a feature is supported or not.This method is modeled after SAX2.
- Parameters:
feature- feature name- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setFeature
void setFeature(String feature, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException Sets a value to a feature.This method is modeled after SAX2.
- Parameters:
feature- feature namevalue- feature value- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
getProperty
Gets a property valueThis method is modeled after SAX2.
- Parameters:
property- property name- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setProperty
void setProperty(String property, Object value) throws SAXNotRecognizedException, SAXNotSupportedException Sets a property valueThis method is modeled after SAX2.
- Parameters:
property- property namevalue- property value- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setErrorHandler
Sets aErrorHandlerthat receives validation errors/warnings.If no error handler is set explicitly, a verifier implementation will not report any error/warning at all. However, the caller can still obtain the result of validation through the return value.
Conscious developers should always set an error handler explicitly as the default behavior has been changed several times.
- Parameters:
handler- this object will receive errors/warning encountered during the validation.
-
setEntityResolver
Sets aEntityResolverto resolve external entity locations.The given entity resolver is used in the
verify(java.lang.String)method and theverify(org.xml.sax.InputSource)method.- Parameters:
handler- EntityResolver
-
verify
validates an XML document.- Parameters:
uri- URI of a document.- Returns:
- true if the document is valid. false if otherwise.
- Throws:
SAXExceptionIOException
-
verify
validates an XML document.- Parameters:
source- InputSource of a XML document to verify.- Returns:
- true if the document is valid. false if otherwise.
- Throws:
SAXExceptionIOException
-
verify
validates an XML document.- Parameters:
file- File to be validated- Returns:
- true if the document is valid. false if otherwise.
- Throws:
SAXExceptionIOException
-
verify
validates an XML document.An implementation is required to accept
Documentobject as the node parameter. If it also implements partial validation, it can also accepts things likeElement.- Parameters:
node- the root DOM node of an XML document.- Returns:
- true if the document is valid. false if otherwise.
- Throws:
UnsupportedOperationException- If the node type of the node parameter is something which this implementation does not support.SAXException
-
getVerifierHandler
Gets a VerifierHandler.you can use the returned
VerifierHandlerto validate documents through SAX.Note that two different invocations of this method can return the same value; this method does NOT necessarily create a new
VerifierHandlerobject.- Throws:
SAXException
-
getVerifierFilter
Gets a VerifierFilter.you can use the returned
VerifierHandlerto validate documents through SAX.Note that two different invocations of this method can return the same value; this method does NOT necessarily create a new
VerifierFilterobject.- Throws:
SAXException
-