com.sun.msv.verifier.psvi
Class TypeDetector

java.lang.Object
  extended by com.sun.msv.verifier.AbstractVerifier
      extended by com.sun.msv.verifier.Verifier
          extended by com.sun.msv.verifier.psvi.TypeDetector
All Implemented Interfaces:
IDContextProvider2, IVerifier, VerifierHandler, ValidationContext, ContentHandler, DTDHandler

public class TypeDetector
extends Verifier

assign types to the incoming SAX2 events and reports them to the application handler through TypedContentHandler. This class "augment" infoset by adding type information. The application can receive augmented infoset by implementing TypedContentHandler.

Author:
Kohsuke KAWAGUCHI

Nested Class Summary
 class TypeDetector.AmbiguousDocumentException
          signals that the document is ambiguous.
 
Field Summary
protected  TypedContentHandler handler
           
 
Fields inherited from class com.sun.msv.verifier.Verifier
current, docDecl, ERR_DUPLICATE_ID, ERR_MISSING_ATTRIBUTE, ERR_UNCOMPLETED_CONTENT, ERR_UNEXPECTED_ATTRIBUTE, ERR_UNEXPECTED_ELEMENT, ERR_UNEXPECTED_STARTTAG, ERR_UNEXPECTED_TEXT, ERR_UNSOLD_IDREF, errorHandler, hadError, panicLevel
 
Fields inherited from class com.sun.msv.verifier.AbstractVerifier
dummyLocator, idrefs, ids, locator, namespaceSupport, performIDcheck
 
Constructor Summary
TypeDetector(DocumentDeclaration documentDecl, ErrorHandler errorHandler)
           
TypeDetector(DocumentDeclaration documentDecl, TypedContentHandler handler, ErrorHandler errorHandler)
           
 
Method Summary
 void characters(char[] buf, int start, int len)
           
 void endDocument()
           
 void endElement(String namespaceUri, String localName, String qName)
           
protected  Datatype[] feedAttribute(Acceptor child, String uri, String localName, String qName, String value)
           
 void ignorableWhitespace(char[] buf, int start, int len)
           
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 setContentHandler(TypedContentHandler handler)
          sets the TypedContentHandler which will received the type-augmented infoset.
 void startDocument()
           
 void startElement(String namespaceUri, String localName, String qName, Attributes atts)
           
protected  void verifyText()
           
 
Methods inherited from class com.sun.msv.verifier.Verifier
getCurrentElementType, getErrorHandler, getLastCharacterType, init, isValid, localizeMessage, onDuplicateId, onError, onError, setErrorHandler, setPanicMode
 
Methods inherited from class com.sun.msv.verifier.AbstractVerifier
endPrefixMapping, getBaseUri, getLocator, isNotation, isUnparsedEntity, notationDecl, onID, processingInstruction, resolveNamespacePrefix, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.msv.verifier.IVerifier
getLocator
 
Methods inherited from interface org.xml.sax.ContentHandler
endPrefixMapping, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
 

Field Detail

handler

protected TypedContentHandler handler
Constructor Detail

TypeDetector

public TypeDetector(DocumentDeclaration documentDecl,
                    ErrorHandler errorHandler)

TypeDetector

public TypeDetector(DocumentDeclaration documentDecl,
                    TypedContentHandler handler,
                    ErrorHandler errorHandler)
Method Detail

setContentHandler

public void setContentHandler(TypedContentHandler handler)
sets the TypedContentHandler which will received the type-augmented infoset.


verifyText

protected void verifyText()
                   throws SAXException
Overrides:
verifyText in class Verifier
Throws:
SAXException

feedAttribute

protected Datatype[] feedAttribute(Acceptor child,
                                   String uri,
                                   String localName,
                                   String qName,
                                   String value)
                            throws SAXException
Overrides:
feedAttribute in class Verifier
Throws:
SAXException

startElement

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

onNextAcceptorReady

protected void onNextAcceptorReady(StartTagInfo sti,
                                   Acceptor nextAcceptor)
                            throws SAXException
Description copied from class: Verifier
this method is called from the startElement method after the tag name is processed and the child acceptor is created.

This method is called before the attributes are consumed.

derived class can use this method to do something useful.

Overrides:
onNextAcceptorReady in class Verifier
Throws:
SAXException

endElement

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

characters

public void characters(char[] buf,
                       int start,
                       int len)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class Verifier
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] buf,
                                int start,
                                int len)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class Verifier
Throws:
SAXException

startDocument

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

endDocument

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


MSV