public class VerifierFilter extends XMLFilterImpl implements IVerifier
| Constructor and Description |
|---|
VerifierFilter(DocumentDeclaration documentDecl,
ErrorHandler errorHandler) |
VerifierFilter(IVerifier verifier) |
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
endDocument() |
void |
endElement(String namespaceURI,
String localName,
String qName) |
void |
endPrefixMapping(String prefix) |
Object |
getCurrentElementType()
returns current element type.
|
ErrorHandler |
getErrorHandler() |
org.relaxng.datatype.Datatype[] |
getLastCharacterType()
gets DataType that validated the last characters.
|
Locator |
getLocator() |
IVerifier |
getVerifier() |
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) |
void |
setErrorHandler(ErrorHandler handler) |
void |
setPanicMode(boolean usePanicMode)
Turns on/off the panic mode.
|
void |
skippedEntity(String name) |
void |
startDocument() |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts) |
void |
startPrefixMapping(String prefix,
String uri) |
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getFeature, getParent, getProperty, notationDecl, parse, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setFeature, setParent, setProperty, unparsedEntityDecl, warningpublic VerifierFilter(IVerifier verifier)
verifier - Verifier object that performs actual validation.public VerifierFilter(DocumentDeclaration documentDecl, ErrorHandler errorHandler)
public boolean isValid()
IVerifierisValid in interface IVerifierisValid in interface VerifierHandlerpublic Object getCurrentElementType()
IVerifiergetCurrentElementType in interface IVerifierpublic org.relaxng.datatype.Datatype[] getLastCharacterType()
IVerifierThis 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.
getLastCharacterType in interface IVerifierpublic final Locator getLocator()
getLocator in interface IVerifierpublic final ErrorHandler getErrorHandler()
getErrorHandler in interface IVerifiergetErrorHandler in interface XMLReadergetErrorHandler in class XMLFilterImplpublic final void setErrorHandler(ErrorHandler handler)
setErrorHandler in interface IVerifiersetErrorHandler in interface XMLReadersetErrorHandler in class XMLFilterImplpublic final void setPanicMode(boolean usePanicMode)
IVerifierHowever, 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,)
setPanicMode in interface IVerifierpublic IVerifier getVerifier()
public void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class XMLFilterImplpublic void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class XMLFilterImplSAXExceptionpublic void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class XMLFilterImplSAXExceptionpublic void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class XMLFilterImplSAXExceptionpublic void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping in interface ContentHandlerendPrefixMapping in class XMLFilterImplSAXExceptionpublic void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement in interface ContentHandlerstartElement in class XMLFilterImplSAXExceptionpublic void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement in interface ContentHandlerendElement in class XMLFilterImplSAXExceptionpublic void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class XMLFilterImplSAXExceptionpublic void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerignorableWhitespace in class XMLFilterImplSAXExceptionpublic void processingInstruction(String target, String data) throws SAXException
processingInstruction in interface ContentHandlerprocessingInstruction in class XMLFilterImplSAXExceptionpublic void skippedEntity(String name) throws SAXException
skippedEntity in interface ContentHandlerskippedEntity in class XMLFilterImplSAXExceptionCopyright © 2017 Oracle Corporation. All rights reserved.