com.sun.msv.schematron.verifier
Class RelmesVerifier

java.lang.Object
  extended by com.sun.msv.schematron.verifier.RelmesVerifier
All Implemented Interfaces:
IVerifier, VerifierHandler, ContentHandler

public class RelmesVerifier
extends Object
implements IVerifier


Constructor Summary
RelmesVerifier(DocumentDeclaration docDecl, ErrorHandler handler)
           
RelmesVerifier(IVerifier core)
           
 
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()
           
 Datatype[] getLastCharacterType()
          gets DataType that validated the last characters.
 Locator getLocator()
           
 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 v)
          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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelmesVerifier

public RelmesVerifier(IVerifier core)
               throws ParserConfigurationException
Throws:
ParserConfigurationException

RelmesVerifier

public RelmesVerifier(DocumentDeclaration docDecl,
                      ErrorHandler handler)
               throws ParserConfigurationException
Throws:
ParserConfigurationException
Method Detail

setPanicMode

public void setPanicMode(boolean v)
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 interface IVerifier

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.

Specified by:
isValid in interface IVerifier
Specified by:
isValid in interface VerifierHandler

getCurrentElementType

public Object 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 interface IVerifier
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 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 interface IVerifier
Returns:
null if type-assignment was not possible.

getLocator

public final Locator getLocator()
Specified by:
getLocator in interface IVerifier

getErrorHandler

public final ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface IVerifier

setErrorHandler

public final void setErrorHandler(ErrorHandler handler)
Specified by:
setErrorHandler in interface IVerifier

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException


MSV