Package com.sun.msv.verifier.psvi
Class TypeDetector
- java.lang.Object
-
- com.sun.msv.verifier.AbstractVerifier
-
- com.sun.msv.verifier.Verifier
-
- com.sun.msv.verifier.psvi.TypeDetector
-
- All Implemented Interfaces:
IDContextProvider2
,IVerifier
,org.iso_relax.verifier.VerifierHandler
,org.relaxng.datatype.ValidationContext
,org.xml.sax.ContentHandler
,org.xml.sax.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
TypeDetector.AmbiguousDocumentException
signals that the document is ambiguous.
-
Field Summary
Fields Modifier and Type Field Description private DatatypeRef
characterType
protected TypedContentHandler
handler
private java.lang.StringBuffer
text
characters that were read (but not processed)-
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
Constructors Constructor Description TypeDetector(DocumentDeclaration documentDecl, TypedContentHandler handler, org.xml.sax.ErrorHandler errorHandler)
TypeDetector(DocumentDeclaration documentDecl, org.xml.sax.ErrorHandler errorHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] buf, int start, int len)
void
endDocument()
void
endElement(java.lang.String namespaceUri, java.lang.String localName, java.lang.String qName)
protected org.relaxng.datatype.Datatype[]
feedAttribute(Acceptor child, java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.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.private void
reportCharacterChunks(java.lang.String text, org.relaxng.datatype.Datatype[] types)
void
setContentHandler(TypedContentHandler handler)
sets the TypedContentHandler which will received the type-augmented infoset.void
startDocument()
void
startElement(java.lang.String namespaceUri, java.lang.String localName, java.lang.String qName, org.xml.sax.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 org.xml.sax.ContentHandler
endPrefixMapping, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
-
Methods inherited from interface com.sun.msv.verifier.IVerifier
getLocator
-
-
-
-
Field Detail
-
text
private java.lang.StringBuffer text
characters that were read (but not processed)
-
handler
protected TypedContentHandler handler
-
characterType
private final DatatypeRef characterType
-
-
Constructor Detail
-
TypeDetector
public TypeDetector(DocumentDeclaration documentDecl, org.xml.sax.ErrorHandler errorHandler)
-
TypeDetector
public TypeDetector(DocumentDeclaration documentDecl, TypedContentHandler handler, org.xml.sax.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 org.xml.sax.SAXException
- Overrides:
verifyText
in classVerifier
- Throws:
org.xml.sax.SAXException
-
reportCharacterChunks
private void reportCharacterChunks(java.lang.String text, org.relaxng.datatype.Datatype[] types) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
feedAttribute
protected org.relaxng.datatype.Datatype[] feedAttribute(Acceptor child, java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.String value) throws org.xml.sax.SAXException
- Overrides:
feedAttribute
in classVerifier
- 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 interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classVerifier
- Throws:
org.xml.sax.SAXException
-
onNextAcceptorReady
protected void onNextAcceptorReady(StartTagInfo sti, Acceptor nextAcceptor) throws org.xml.sax.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 classVerifier
- 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 interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classVerifier
- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] buf, int start, int len) throws org.xml.sax.SAXException
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classVerifier
- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] buf, int start, int len) throws org.xml.sax.SAXException
- Specified by:
ignorableWhitespace
in interfaceorg.xml.sax.ContentHandler
- Overrides:
ignorableWhitespace
in classVerifier
- Throws:
org.xml.sax.SAXException
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classVerifier
- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classVerifier
- Throws:
org.xml.sax.SAXException
-
-