Class VerifierImpl
- java.lang.Object
-
- org.iso_relax.verifier.impl.VerifierImpl
-
- All Implemented Interfaces:
Verifier
public abstract class VerifierImpl extends java.lang.Object implements Verifier
Partial implementation ofVerifier.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
getVerifierHandlermethod. Please be noted that applications can call thesetErrorHandlermethod after thegetVerifierHandlermethod and that change should take effect.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.xml.sax.EntityResolverentityResolverprotected org.xml.sax.ErrorHandlererrorHandlerprotected org.xml.sax.XMLReaderreader-
Fields inherited from interface org.iso_relax.verifier.Verifier
FEATURE_FILTER, FEATURE_HANDLER
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedVerifierImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetProperty(java.lang.String property)Gets a property valueVerifierFiltergetVerifierFilter()Gets a VerifierFilter.abstract VerifierHandlergetVerifierHandler()Gets a VerifierHandler.booleanisFeature(java.lang.String feature)Checks whether a feature is supported or not.protected voidprepareXMLReader()Creates and sets a sole instance of XMLReader which will be used by this verifier.voidsetEntityResolver(org.xml.sax.EntityResolver resolver)Sets aEntityResolverto resolve external entity locations.voidsetErrorHandler(org.xml.sax.ErrorHandler handler)Sets aErrorHandlerthat receives validation errors/warnings.voidsetFeature(java.lang.String feature, boolean value)Sets a value to a feature.voidsetProperty(java.lang.String property, java.lang.Object value)Sets a property valuebooleanverify(java.io.File f)validates an XML document.booleanverify(java.lang.String uri)validates an XML document.booleanverify(org.w3c.dom.Node node)validates an XML document.booleanverify(org.xml.sax.InputSource source)validates an XML document.
-
-
-
Constructor Detail
-
VerifierImpl
protected VerifierImpl() throws VerifierConfigurationException- Throws:
VerifierConfigurationException
-
-
Method Detail
-
prepareXMLReader
protected void prepareXMLReader() throws VerifierConfigurationExceptionCreates and sets a sole instance of XMLReader which will be used by this verifier.- Throws:
VerifierConfigurationException
-
isFeature
public boolean isFeature(java.lang.String feature) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionDescription copied from interface:VerifierChecks whether a feature is supported or not.This method is modeled after SAX2.
-
setFeature
public void setFeature(java.lang.String feature, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionDescription 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:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
getProperty
public java.lang.Object getProperty(java.lang.String property) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionDescription copied from interface:VerifierGets a property valueThis method is modeled after SAX2.
- Specified by:
getPropertyin interfaceVerifier- Parameters:
property- property name- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
setProperty
public void setProperty(java.lang.String property, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionDescription copied from interface:VerifierSets a property valueThis method is modeled after SAX2.
- Specified by:
setPropertyin interfaceVerifier- Parameters:
property- property namevalue- property value- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
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
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
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
public boolean verify(java.lang.String uri) throws org.xml.sax.SAXException, java.io.IOExceptionDescription copied from interface:Verifiervalidates an XML document.
-
verify
public boolean verify(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, java.io.IOExceptionDescription copied from interface:Verifiervalidates an XML document.
-
verify
public boolean verify(java.io.File f) throws org.xml.sax.SAXException, java.io.IOExceptionDescription copied from interface:Verifiervalidates an XML document.
-
verify
public boolean verify(org.w3c.dom.Node node) throws org.xml.sax.SAXExceptionDescription 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.
-
getVerifierHandler
public abstract VerifierHandler getVerifierHandler() throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
-
getVerifierFilter
public VerifierFilter getVerifierFilter() throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
-
-