Class VerifierImpl
- All Implemented Interfaces:
Verifier
Verifier.
This class is useful as the base class of the verifier implementation.
The only remaining method that has to be implemented by the derived
class is the getVerifierHandler method. Please be noted
that applications can call the setErrorHandler method
after the getVerifierHandler method and that change
should take effect.
- Version:
- $Id: VerifierImpl.java,v 1.4 2003/05/30 23:46:33 kkawa Exp $
- Author:
- Kohsuke KAWAGUCHI
-
Method Summary
Modifier and TypeMethodDescriptiongetProperty(String property) Gets a property valueGets a VerifierFilter.abstract VerifierHandlerGets a VerifierHandler.booleanChecks whether a feature is supported or not.voidsetEntityResolver(EntityResolver resolver) 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
Description copied from interface:VerifierChecks whether a feature is supported or not.This method is modeled after SAX2.
- Specified by:
isFeaturein interfaceVerifier- Parameters:
feature- feature name- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setFeature
public void setFeature(String feature, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException Description copied from interface:VerifierSets a value to a feature.This method is modeled after SAX2.
- Specified by:
setFeaturein interfaceVerifier- Parameters:
feature- feature namevalue- feature value- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
getProperty
public Object getProperty(String property) throws SAXNotRecognizedException, SAXNotSupportedException Description copied from interface:VerifierGets a property valueThis method is modeled after SAX2.
- Specified by:
getPropertyin interfaceVerifier- Parameters:
property- property name- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setProperty
public void setProperty(String property, Object value) throws SAXNotRecognizedException, SAXNotSupportedException Description copied from interface:VerifierSets a property valueThis method is modeled after SAX2.
- Specified by:
setPropertyin interfaceVerifier- Parameters:
property- property namevalue- property value- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setErrorHandler
Description copied from interface:VerifierSets 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.
- Specified by:
setErrorHandlerin interfaceVerifier- Parameters:
handler- this object will receive errors/warning encountered during the validation.
-
setEntityResolver
Description copied from interface:VerifierSets aEntityResolverto resolve external entity locations.The given entity resolver is used in the
Verifier.verify(java.lang.String)method and theVerifier.verify(org.xml.sax.InputSource)method.- Specified by:
setEntityResolverin interfaceVerifier- Parameters:
resolver- EntityResolver
-
verify
Description copied from interface:Verifiervalidates an XML document.- Specified by:
verifyin interfaceVerifier- Parameters:
uri- URI of a document.- Returns:
- true if the document is valid. false if otherwise.
- Throws:
SAXExceptionIOException
-
verify
Description copied from interface:Verifiervalidates an XML document.- Specified by:
verifyin interfaceVerifier- Parameters:
source- InputSource of a XML document to verify.- Returns:
- true if the document is valid. false if otherwise.
- Throws:
SAXExceptionIOException
-
verify
Description copied from interface:Verifiervalidates an XML document.- Specified by:
verifyin interfaceVerifier- Parameters:
f- File to be validated- Returns:
- true if the document is valid. false if otherwise.
- Throws:
SAXExceptionIOException
-
verify
Description copied from interface:Verifiervalidates 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.- Specified by:
verifyin interfaceVerifier- Parameters:
node- the root DOM node of an XML document.- Returns:
- true if the document is valid. false if otherwise.
- Throws:
SAXException
-
getVerifierHandler
Description copied from interface:VerifierGets 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.- Specified by:
getVerifierHandlerin interfaceVerifier- Throws:
SAXException
-
getVerifierFilter
Description copied from interface:VerifierGets 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.- Specified by:
getVerifierFilterin interfaceVerifier- Throws:
SAXException
-