Class VerifierFilter
- All Implemented Interfaces:
IVerifier
,org.iso_relax.verifier.VerifierHandler
,ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,XMLFilter
,XMLReader
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVerifierFilter
(DocumentDeclaration documentDecl, ErrorHandler errorHandler) VerifierFilter
(IVerifier verifier) -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) void
void
endElement
(String namespaceURI, String localName, String qName) void
endPrefixMapping
(String prefix) returns current element type.final ErrorHandler
org.relaxng.datatype.Datatype[]
gets DataType that validated the last characters.final Locator
void
ignorableWhitespace
(char[] ch, int start, int length) boolean
isValid()
checks if the document was valid.void
processingInstruction
(String target, String data) void
setDocumentLocator
(Locator locator) final void
setErrorHandler
(ErrorHandler handler) final void
setPanicMode
(boolean usePanicMode) Turns on/off the panic mode.void
skippedEntity
(String name) void
void
startElement
(String namespaceURI, String localName, String qName, Attributes atts) void
startPrefixMapping
(String prefix, String uri) Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getFeature, getParent, getProperty, notationDecl, parse, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setFeature, setParent, setProperty, unparsedEntityDecl, warning
-
Field Details
-
verifier
-
-
Constructor Details
-
VerifierFilter
- Parameters:
verifier
- Verifier object that performs actual validation.
-
VerifierFilter
-
-
Method Details
-
isValid
public boolean isValid()Description copied from interface:IVerifier
checks if the document was valid. This method may not be called before verification was completed. -
getCurrentElementType
Description copied from interface:IVerifier
returns current element type. Actual java type depends on the implementation. This method works correctly only when called immediately after handling startElement event.- Specified by:
getCurrentElementType
in interfaceIVerifier
- Returns:
- null this method returns null when it doesn't support type-assignment feature, or type-assignment is impossible for the current element (for example due to the ambiguous grammar).
-
getLastCharacterType
public org.relaxng.datatype.Datatype[] getLastCharacterType()Description copied from interface:IVerifier
gets DataType that validated the last characters.This method works correctly only when called immediately after startElement and endElement method. When called, this method returns DataType object that validated the last character literals.
For RELAX NG grammar, this method can return an array of length 2 or more. This happens when the last character matches <list> pattern. In that case, each type corresponds to each token (where tokens are the white-space separation of the last characters).
For any other grammar, this method always returns an array of length 1 (or null, if the type assignment failed).
So when you are using VerifierFilter, you can call this method only in your startElement and endElement method.
- Specified by:
getLastCharacterType
in interfaceIVerifier
- Returns:
- null if type-assignment was not possible.
-
getLocator
- Specified by:
getLocator
in interfaceIVerifier
-
getErrorHandler
- Specified by:
getErrorHandler
in interfaceIVerifier
- Specified by:
getErrorHandler
in interfaceXMLReader
- Overrides:
getErrorHandler
in classXMLFilterImpl
-
setErrorHandler
- Specified by:
setErrorHandler
in interfaceIVerifier
- Specified by:
setErrorHandler
in interfaceXMLReader
- Overrides:
setErrorHandler
in classXMLFilterImpl
-
setPanicMode
public final void setPanicMode(boolean usePanicMode) Description copied from interface:IVerifier
Turns on/off the panic mode. Panic mode is on by default. Turning it on is good for general use. It prevents false error messages to appear.However, turning it off is sometimes useful, when you are sure that the structure of the document is almost valid (e.g., validating a document generated by an application or when you are sure about the validity of the structure and only interested in validating datatypes,)
- Specified by:
setPanicMode
in interfaceIVerifier
-
getVerifier
-
setDocumentLocator
- Specified by:
setDocumentLocator
in interfaceContentHandler
- Overrides:
setDocumentLocator
in classXMLFilterImpl
-
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classXMLFilterImpl
- Throws:
SAXException
-
endDocument
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classXMLFilterImpl
- Throws:
SAXException
-
startPrefixMapping
- Specified by:
startPrefixMapping
in interfaceContentHandler
- Overrides:
startPrefixMapping
in classXMLFilterImpl
- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMapping
in interfaceContentHandler
- Overrides:
endPrefixMapping
in classXMLFilterImpl
- Throws:
SAXException
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classXMLFilterImpl
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classXMLFilterImpl
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classXMLFilterImpl
- Throws:
SAXException
-
ignorableWhitespace
- Specified by:
ignorableWhitespace
in interfaceContentHandler
- Overrides:
ignorableWhitespace
in classXMLFilterImpl
- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstruction
in interfaceContentHandler
- Overrides:
processingInstruction
in classXMLFilterImpl
- Throws:
SAXException
-
skippedEntity
- Specified by:
skippedEntity
in interfaceContentHandler
- Overrides:
skippedEntity
in classXMLFilterImpl
- Throws:
SAXException
-