com.sun.msv.verifier
Class AbstractVerifier

java.lang.Object
  extended by com.sun.msv.verifier.AbstractVerifier
All Implemented Interfaces:
IDContextProvider2, ValidationContext, ContentHandler, DTDHandler
Direct Known Subclasses:
Verifier

public abstract class AbstractVerifier
extends Object
implements ContentHandler, DTDHandler, IDContextProvider2

Base implementation for various Verifier implementations. This implementation provides common service like:

  1. collecting ID/IDREFs.
  2. storing Locator.

    By setting performIDcheck variable, the ID/IDREF checking can be either turned on or turned off.

    Author:
    Kohsuke KAWAGUCHI

    Field Summary
    protected static Locator dummyLocator
               
    protected  Set idrefs
              this map remembers every IDREF token encountered in this document
    protected  Map ids
              this map remembers every ID token encountered in this document
    protected  Locator locator
              Document Locator that is given by XML reader.
    protected  NamespaceSupport namespaceSupport
              namespace prefix to namespace URI resolver.
    protected  boolean performIDcheck
              set this flag to true to perform ID/IDREF validation.
     
    Constructor Summary
    AbstractVerifier()
               
     
    Method Summary
     void endElement(String namespaceUri, String localName, String qName)
               
     void endPrefixMapping(String prefix)
               
     String getBaseUri()
               
     Locator getLocator()
               
    protected  void init()
               
     boolean isNotation(String notationName)
               
     boolean isUnparsedEntity(String entityName)
               
     void notationDecl(String name, String publicId, String systemId)
               
    protected abstract  void onDuplicateId(String id)
              this method is called when a duplicate id value is found.
     void onID(Datatype dt, StringToken token)
              this method is called when a type with ID semantics is matched.
     void processingInstruction(String name, String data)
               
     String resolveNamespacePrefix(String prefix)
               
     void setDocumentLocator(Locator loc)
               
     void skippedEntity(String p)
               
     void startElement(String namespaceUri, String localName, String qName, Attributes atts)
               
     void startPrefixMapping(String prefix, String uri)
               
     void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     
    Methods inherited from interface org.xml.sax.ContentHandler
    characters, endDocument, ignorableWhitespace, startDocument
     

    Field Detail

    locator

    protected Locator locator
    Document Locator that is given by XML reader. Sometimes it doesn't set the locator, so start with a dummy instance.


    dummyLocator

    protected static final Locator dummyLocator

    performIDcheck

    protected boolean performIDcheck
    set this flag to true to perform ID/IDREF validation. this value cannot be modified in the middle of the validation.


    ids

    protected final Map ids
    this map remembers every ID token encountered in this document


    idrefs

    protected final Set idrefs
    this map remembers every IDREF token encountered in this document


    namespaceSupport

    protected final NamespaceSupport namespaceSupport
    namespace prefix to namespace URI resolver. this object memorizes mapping information.

    Constructor Detail

    AbstractVerifier

    public AbstractVerifier()
    Method Detail

    getLocator

    public final Locator getLocator()

    setDocumentLocator

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

    skippedEntity

    public void skippedEntity(String p)
    Specified by:
    skippedEntity in interface ContentHandler

    processingInstruction

    public void processingInstruction(String name,
                                      String data)
    Specified by:
    processingInstruction in interface ContentHandler

    startPrefixMapping

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

    endPrefixMapping

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

    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

    init

    protected void init()

    notationDecl

    public void notationDecl(String name,
                             String publicId,
                             String systemId)
    Specified by:
    notationDecl in interface DTDHandler

    unparsedEntityDecl

    public void unparsedEntityDecl(String name,
                                   String publicId,
                                   String systemId,
                                   String notationName)
    Specified by:
    unparsedEntityDecl in interface DTDHandler

    resolveNamespacePrefix

    public String resolveNamespacePrefix(String prefix)
    Specified by:
    resolveNamespacePrefix in interface ValidationContext

    isUnparsedEntity

    public boolean isUnparsedEntity(String entityName)
    Specified by:
    isUnparsedEntity in interface ValidationContext

    isNotation

    public boolean isNotation(String notationName)
    Specified by:
    isNotation in interface ValidationContext

    getBaseUri

    public String getBaseUri()
    Specified by:
    getBaseUri in interface ValidationContext

    onDuplicateId

    protected abstract void onDuplicateId(String id)
    this method is called when a duplicate id value is found.


    onID

    public void onID(Datatype dt,
                     StringToken token)
    Description copied from interface: IDContextProvider2
    this method is called when a type with ID semantics is matched. It is the callee's responsibility that stores ID and checks doubly defined ID, if it is necessary.

    Specified by:
    onID in interface IDContextProvider2


    MSV