public class Verifier extends AbstractVerifier implements IVerifier
| Modifier and Type | Field and Description |
|---|---|
protected Acceptor |
current |
protected DocumentDeclaration |
docDecl
Schema object against which the validation will be done
|
static String |
ERR_DUPLICATE_ID |
static String |
ERR_MISSING_ATTRIBUTE |
static String |
ERR_UNCOMPLETED_CONTENT |
static String |
ERR_UNEXPECTED_ATTRIBUTE |
static String |
ERR_UNEXPECTED_ELEMENT |
static String |
ERR_UNEXPECTED_STARTTAG |
static String |
ERR_UNEXPECTED_TEXT |
static String |
ERR_UNSOLD_IDREF |
protected ErrorHandler |
errorHandler
Error handler
|
protected boolean |
hadError
This flag will be set to true if an error is found
|
protected int |
panicLevel
Panic level.
|
dummyLocator, idrefs, ids, locator, namespaceSupport, performIDcheck| Constructor and Description |
|---|
Verifier(DocumentDeclaration documentDecl,
ErrorHandler errorHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] buf,
int start,
int len) |
void |
endDocument() |
void |
endElement(String namespaceUri,
String localName,
String qName) |
protected org.relaxng.datatype.Datatype[] |
feedAttribute(Acceptor child,
String uri,
String localName,
String qName,
String value) |
Object |
getCurrentElementType()
returns current element type.
|
ErrorHandler |
getErrorHandler() |
org.relaxng.datatype.Datatype[] |
getLastCharacterType()
gets DataType that validated the last characters.
|
void |
ignorableWhitespace(char[] buf,
int start,
int len) |
protected void |
init() |
boolean |
isValid()
checks if the document was valid.
|
static String |
localizeMessage(String propertyName,
Object[] args) |
void |
onDuplicateId(String id)
this method is called when a duplicate id value is found.
|
protected ValidityViolation |
onError(String msg,
ErrorInfo ei) |
protected ValidityViolation |
onError(StringRef ref,
String defaultMsg,
ErrorInfo ei)
signals an error.
|
protected void |
onNextAcceptorReady(StartTagInfo sti,
Acceptor nextAcceptor)
this method is called from the startElement method
after the tag name is processed and the child acceptor is created.
|
void |
setErrorHandler(ErrorHandler handler) |
void |
setPanicMode(boolean usePanicMode)
Turns on/off the panic mode.
|
void |
startDocument() |
void |
startElement(String namespaceUri,
String localName,
String qName,
Attributes atts) |
protected void |
verifyText() |
endPrefixMapping, getBaseUri, getLocator, isNotation, isUnparsedEntity, notationDecl, onID, processingInstruction, resolveNamespacePrefix, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDeclclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocatorendPrefixMapping, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMappingprotected Acceptor current
protected ErrorHandler errorHandler
protected boolean hadError
protected final DocumentDeclaration docDecl
protected int panicLevel
public static final String ERR_UNEXPECTED_TEXT
public static final String ERR_UNEXPECTED_ATTRIBUTE
public static final String ERR_MISSING_ATTRIBUTE
public static final String ERR_UNEXPECTED_STARTTAG
public static final String ERR_UNCOMPLETED_CONTENT
public static final String ERR_UNEXPECTED_ELEMENT
public static final String ERR_UNSOLD_IDREF
public static final String ERR_DUPLICATE_ID
public Verifier(DocumentDeclaration documentDecl, ErrorHandler errorHandler)
public final ErrorHandler getErrorHandler()
getErrorHandler in interface IVerifierpublic final void setErrorHandler(ErrorHandler handler)
setErrorHandler in interface IVerifierpublic final boolean isValid()
IVerifierpublic 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 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 IVerifierprotected void verifyText()
throws SAXException
SAXExceptionpublic void startElement(String namespaceUri, String localName, String qName, Attributes atts) throws SAXException
startElement in interface ContentHandlerstartElement in class AbstractVerifierSAXExceptionprotected void onNextAcceptorReady(StartTagInfo sti, Acceptor nextAcceptor) throws SAXException
This method is called before the attributes are consumed.
derived class can use this method to do something useful.
SAXExceptionprotected org.relaxng.datatype.Datatype[] feedAttribute(Acceptor child, String uri, String localName, String qName, String value) throws SAXException
SAXExceptionpublic void endElement(String namespaceUri, String localName, String qName) throws SAXException
endElement in interface ContentHandlerendElement in class AbstractVerifierSAXExceptionprotected ValidityViolation onError(StringRef ref, String defaultMsg, ErrorInfo ei) throws SAXException
SAXExceptionprotected ValidityViolation onError(String msg, ErrorInfo ei) throws SAXException
SAXExceptionpublic Object getCurrentElementType()
IVerifiergetCurrentElementType in interface IVerifierpublic void characters(char[] buf,
int start,
int len)
throws SAXException
characters in interface ContentHandlerSAXExceptionpublic void ignorableWhitespace(char[] buf,
int start,
int len)
throws SAXException
ignorableWhitespace in interface ContentHandlerSAXExceptionprotected void init()
init in class AbstractVerifierpublic void startDocument()
throws SAXException
startDocument in interface ContentHandlerSAXExceptionpublic void endDocument()
throws SAXException
endDocument in interface ContentHandlerSAXExceptionpublic void onDuplicateId(String id)
AbstractVerifieronDuplicateId in class AbstractVerifierCopyright © 2016 Oracle Corporation. All Rights Reserved.