Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.msv.verifier
Class VerifierFilter

    java.lang.Object
      org.xml.sax.helpers.XMLFilterImpl
          com.sun.msv.verifier.VerifierFilter

All Implemented Interfaces:
  org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, IVerifier, org.iso_relax.verifier.VerifierHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public class VerifierFilter
extends org.xml.sax.helpers.XMLFilterImpl
implements IVerifier

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.

Author:
  Kohsuke KAWAGUCHI

Constructor Summary
`VerifierFilter(DocumentDeclaration documentDecl, org.xml.sax.ErrorHandler errorHandler)`
`VerifierFilter(IVerifier verifier)`

Method Summary
`void` | `characters(char[] ch, int start, int length)`
`void` | `endDocument()`
`void` | `endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)`
`void` | `endPrefixMapping(java.lang.String prefix)`
`java.lang.Object` | `getCurrentElementType()` returns current element type.
`org.xml.sax.ErrorHandler` | `getErrorHandler()`
`Datatype[]` | `getLastCharacterType()` gets DataType that validated the last characters.
`org.xml.sax.Locator` | `getLocator()`
`IVerifier` | `getVerifier()`
`void` | `ignorableWhitespace(char[] ch, int start, int length)`
`boolean` | `isValid()` checks if the document was valid.
`void` | `processingInstruction(java.lang.String target, java.lang.String data)`
`void` | `setDocumentLocator(org.xml.sax.Locator locator)`
`void` | `setErrorHandler(org.xml.sax.ErrorHandler handler)`
`void` | `setPanicMode(boolean usePanicMode)` Turns on/off the panic mode.
`void` | `skippedEntity(java.lang.String name)`
`void` | `startDocument()`
`void` | `startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)`
`void` | `startPrefixMapping(java.lang.String prefix, java.lang.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
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### VerifierFilter

    public VerifierFilter(IVerifier verifier)

Parameters:
  `verifier` - Verifier object that performs actual validation.

### VerifierFilter

    public VerifierFilter(DocumentDeclaration documentDecl,
                          org.xml.sax.ErrorHandler errorHandler)

Method Detail

### 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`

### getCurrentElementType

    public java.lang.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 org.xml.sax.Locator getLocator()

  Specified by:
    `getLocator` in interface `IVerifier`

### getErrorHandler

    public final org.xml.sax.ErrorHandler getErrorHandler()

  Specified by:
    `getErrorHandler` in interface `IVerifier`

### setErrorHandler

    public final void setErrorHandler(org.xml.sax.ErrorHandler handler)

  Specified by:
    `setErrorHandler` in interface `IVerifier`

### setPanicMode

    public final void setPanicMode(boolean usePanicMode)

  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`

### getVerifier

    public IVerifier getVerifier()

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator locator)

  Specified by:
    `setDocumentLocator` in interface `org.xml.sax.ContentHandler`

### startDocument

    public void startDocument()
                       throws org.xml.sax.SAXException

  Specified by:
    `startDocument` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### endDocument

    public void endDocument()
                     throws org.xml.sax.SAXException

  Specified by:
    `endDocument` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### startPrefixMapping

    public void startPrefixMapping(java.lang.String prefix,
                                   java.lang.String uri)
                            throws org.xml.sax.SAXException

  Specified by:
    `startPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### endPrefixMapping

    public void endPrefixMapping(java.lang.String prefix)
                          throws org.xml.sax.SAXException

  Specified by:
    `endPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### startElement

    public void startElement(java.lang.String namespaceURI,
                             java.lang.String localName,
                             java.lang.String qName,
                             org.xml.sax.Attributes atts)
                      throws org.xml.sax.SAXException

  Specified by:
    `startElement` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### endElement

    public void endElement(java.lang.String namespaceURI,
                           java.lang.String localName,
                           java.lang.String qName)
                    throws org.xml.sax.SAXException

  Specified by:
    `endElement` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### characters

    public void characters(char[] ch,
                           int start,
                           int length)
                    throws org.xml.sax.SAXException

  Specified by:
    `characters` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                                    int start,
                                    int length)
                             throws org.xml.sax.SAXException

  Specified by:
    `ignorableWhitespace` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### processingInstruction

    public void processingInstruction(java.lang.String target,
                                      java.lang.String data)
                               throws org.xml.sax.SAXException

  Specified by:
    `processingInstruction` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### skippedEntity

    public void skippedEntity(java.lang.String name)
                       throws org.xml.sax.SAXException

  Specified by:
    `skippedEntity` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD