public class VerifierFilter extends org.xml.sax.helpers.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, warning
public VerifierFilter(IVerifier verifier)
verifier
- Verifier object that performs actual validation.public VerifierFilter(DocumentDeclaration documentDecl, ErrorHandler errorHandler)
public boolean isValid()
IVerifier
public Object getCurrentElementType()
IVerifier
getCurrentElementType
in interface IVerifier
public org.relaxng.datatype.Datatype[] getLastCharacterType()
IVerifier
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.
getLastCharacterType
in interface IVerifier
public final Locator getLocator()
getLocator
in interface IVerifier
public final ErrorHandler getErrorHandler()
getErrorHandler
in interface IVerifier
getErrorHandler
in interface XMLReader
getErrorHandler
in class org.xml.sax.helpers.XMLFilterImpl
public final void setErrorHandler(ErrorHandler handler)
setErrorHandler
in interface IVerifier
setErrorHandler
in interface XMLReader
setErrorHandler
in class org.xml.sax.helpers.XMLFilterImpl
public final void setPanicMode(boolean usePanicMode)
IVerifier
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,)
setPanicMode
in interface IVerifier
public IVerifier getVerifier()
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.XMLFilterImpl
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ignorableWhitespace
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
processingInstruction
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
skippedEntity
in class org.xml.sax.helpers.XMLFilterImpl
SAXException
Copyright © 2016 Oracle Corporation. All rights reserved.