|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Verifier
An instance of this interface can validates documents.
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.
Method Summary | |
---|---|
java.lang.Object |
getProperty(java.lang.String property)
Gets a property value |
VerifierFilter |
getVerifierFilter()
Gets a VerifierFilter. |
VerifierHandler |
getVerifierHandler()
Gets a VerifierHandler. |
boolean |
isFeature(java.lang.String feature)
Checks whether a feature is supported or not. |
void |
setEntityResolver(org.xml.sax.EntityResolver handler)
Sets a EntityResolver to resolve external entity locations. |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Sets a ErrorHandler that receives validation
errors/warnings. |
void |
setFeature(java.lang.String feature,
boolean value)
Sets a value to a feature. |
void |
setProperty(java.lang.String property,
java.lang.Object value)
Sets a property value |
boolean |
verify(java.io.File file)
validates an XML document. |
boolean |
verify(org.xml.sax.InputSource source)
validates an XML document. |
boolean |
verify(org.w3c.dom.Node node)
validates an XML document. |
boolean |
verify(java.lang.String uri)
validates an XML document. |
Method Detail |
---|
java.lang.Object getProperty(java.lang.String property) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
This method is modeled after SAX2.
property
- property name
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
VerifierFilter getVerifierFilter() throws org.xml.sax.SAXException
you can use the returned
VerifierHandler
to 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 VerifierFilter
object.
org.xml.sax.SAXException
VerifierHandler getVerifierHandler() throws org.xml.sax.SAXException
you can use the returned
VerifierHandler
to 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 VerifierHandler
object.
org.xml.sax.SAXException
boolean isFeature(java.lang.String feature) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
This method is modeled after SAX2.
feature
- feature name
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
void setEntityResolver(org.xml.sax.EntityResolver handler)
EntityResolver
to resolve external entity locations.
The given entity resolver is used in the
verify(String)
method and the
verify(InputSource)
method.
handler
- EntityResolvervoid setErrorHandler(org.xml.sax.ErrorHandler handler)
ErrorHandler
that 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.
handler
- this object will receive errors/warning encountered
during the validation.void setFeature(java.lang.String feature, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
This method is modeled after SAX2.
feature
- feature namevalue
- feature value
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
void setProperty(java.lang.String property, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
This method is modeled after SAX2.
property
- property namevalue
- property value
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
boolean verify(java.io.File file) throws org.xml.sax.SAXException, java.io.IOException
file
- File to be validated
org.xml.sax.SAXException
java.io.IOException
boolean verify(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, java.io.IOException
source
- InputSource of a XML document to verify.
org.xml.sax.SAXException
java.io.IOException
boolean verify(org.w3c.dom.Node node) throws org.xml.sax.SAXException
An implementation is required to accept Document
object
as the node parameter. If it also implements partial validation,
it can also accepts things like Element
.
node
- the root DOM node of an XML document.
java.lang.UnsupportedOperationException
- If the node type of the node parameter is something which
this implementation does not support.
org.xml.sax.SAXException
boolean verify(java.lang.String uri) throws org.xml.sax.SAXException, java.io.IOException
uri
- URI of a document.
org.xml.sax.SAXException
java.io.IOException
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |