|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xml.sax.helpers.XMLFilterImpl
com.sun.msv.verifier.VerifierFilter
public class VerifierFilter
SAX XMLFilter that verifies incoming SAX event stream. This object can be reused to validate multiple documents. Just be careful NOT to use the same object to validate more than one documents at the same time.
| Constructor Summary | |
|---|---|
VerifierFilter(DocumentDeclaration documentDecl,
ErrorHandler errorHandler)
|
|
VerifierFilter(IVerifier verifier)
|
|
| Method Summary | |
|---|---|
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)
|
| 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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VerifierFilter(IVerifier verifier)
verifier - Verifier object that performs actual validation.
public VerifierFilter(DocumentDeclaration documentDecl,
ErrorHandler errorHandler)
| Method Detail |
|---|
public boolean isValid()
IVerifier
isValid in interface IVerifierisValid in interface org.iso_relax.verifier.VerifierHandlerpublic Object getCurrentElementType()
IVerifier
getCurrentElementType 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 org.xml.sax.helpers.XMLFilterImplpublic final void setErrorHandler(ErrorHandler handler)
setErrorHandler in interface IVerifiersetErrorHandler in interface XMLReadersetErrorHandler in class org.xml.sax.helpers.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 org.xml.sax.helpers.XMLFilterImpl
public void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.XMLFilterImplSAXException
public void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class org.xml.sax.helpers.XMLFilterImplSAXException
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.XMLFilterImplSAXException
public void endPrefixMapping(String prefix)
throws SAXException
endPrefixMapping in interface ContentHandlerendPrefixMapping in class org.xml.sax.helpers.XMLFilterImplSAXException
public void startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException
startElement in interface ContentHandlerstartElement in class org.xml.sax.helpers.XMLFilterImplSAXException
public void endElement(String namespaceURI,
String localName,
String qName)
throws SAXException
endElement in interface ContentHandlerendElement in class org.xml.sax.helpers.XMLFilterImplSAXException
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class org.xml.sax.helpers.XMLFilterImplSAXException
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerignorableWhitespace in class org.xml.sax.helpers.XMLFilterImplSAXException
public void processingInstruction(String target,
String data)
throws SAXException
processingInstruction in interface ContentHandlerprocessingInstruction in class org.xml.sax.helpers.XMLFilterImplSAXException
public void skippedEntity(String name)
throws SAXException
skippedEntity in interface ContentHandlerskippedEntity in class org.xml.sax.helpers.XMLFilterImplSAXException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||