com.sun.msv.verifier
Class AbstractVerifier

java.lang.Object
  |
  +--com.sun.msv.verifier.AbstractVerifier
All Implemented Interfaces:
ContentHandler, DTDHandler, IDContextProvider, ValidationContext
Direct Known Subclasses:
Verifier

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

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

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

    Author:
    Kohsuke KAWAGUCHI

    Constructor Summary
    AbstractVerifier()
               
     
    Method Summary
     void endElement(String namespaceUri, String localName, String qName)
               
     void endPrefixMapping(String prefix)
               
     Locator getLocator()
               
     boolean isNotation(String notationName)
              checks if a notation is declared with the specified name.
     boolean isUnparsedEntity(String entityName)
              checks if an unparsed entity is declared with the specified name.
     void notationDecl(String name, String publicId, String systemId)
               
     boolean onID(String uri, String local, Object token)
              this method is called when another ID is found to check whether this ID is already used or not.
     void onIDREF(String uri, String local, Object token)
              this method is called when an IDREF is found.
     void processingInstruction(String name, String data)
               
     String resolveNamespacePrefix(String prefix)
              Resolves a namespace prefix to the corresponding namespace URI.
     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
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     
    Methods inherited from interface org.xml.sax.ContentHandler
    characters, endDocument, ignorableWhitespace, startDocument
     

    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

    endElement

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

    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)
    Description copied from interface: ValidationContext
    Resolves a namespace prefix to the corresponding namespace URI. This method is used for validating QName, for example.

    If the prefix is "" (empty string), it indicates unprefixed value. The callee should resolved it as if it sees an unprefixed element, rather than unprefixed attribute.

    If the prefix is "xml", then the callee must resolve this prefix into "http://www.w3.org/XML/1998/namespace", as defined in the XML Namespace rec.

    Specified by:
    resolveNamespacePrefix in interface ValidationContext
    Following copied from interface: org.relaxng.datatype.ValidationContext
    Returns:
    namespace URI of this prefix. If the specified prefix is not declared, the implementation must return null.

    isUnparsedEntity

    public boolean isUnparsedEntity(String entityName)
    Description copied from interface: ValidationContext
    checks if an unparsed entity is declared with the specified name.
    Specified by:
    isUnparsedEntity in interface ValidationContext
    Following copied from interface: org.relaxng.datatype.ValidationContext
    Returns:
    true if DTD has an unparsed entity declaration for the specified name. false if otherwise.

    isNotation

    public boolean isNotation(String notationName)
    Description copied from interface: ValidationContext
    checks if a notation is declared with the specified name.
    Specified by:
    isNotation in interface ValidationContext
    Following copied from interface: org.relaxng.datatype.ValidationContext
    Returns:
    true if DTD has a notation declaration with the specified name. false if otherwise.

    onIDREF

    public void onIDREF(String uri,
                        String local,
                        Object token)
    Description copied from interface: IDContextProvider
    this method is called when an IDREF is found. It is the callee's responsibility to store it and checks the existance of corresponding IDs later. Note that due to the forward reference, it is not possible to perform this check when IDREF is found. It must be done separately after parsing the entire document.
    Specified by:
    onIDREF in interface IDContextProvider

    onID

    public boolean onID(String uri,
                        String local,
                        Object token)
    Description copied from interface: IDContextProvider
    this method is called when another ID is found to check whether this ID is already used or not. It is the callee's responsibility that stores ID and checks doubly defined ID.
    Specified by:
    onID in interface IDContextProvider
    Following copied from interface: com.sun.msv.grammar.IDContextProvider
    Parameters:
    symbolSpaceName - token has to be unique within the same symbol space, but two tokens can have the same name if they reside in different symbol spaces.
    Returns:
    true if there is no preceding ID of the same name; false if this name is already declared as ID.