be.ac.ulg.montefiore.run.totem.util.jaxb.runtime
Class ValidatingUnmarshaller

java.lang.Object
  extended by org.iso_relax.verifier.impl.ForkContentHandler
      extended by be.ac.ulg.montefiore.run.totem.util.jaxb.runtime.ValidatingUnmarshaller
All Implemented Interfaces:
SAXUnmarshallerHandler, javax.xml.bind.UnmarshallerHandler, org.xml.sax.ContentHandler

public class ValidatingUnmarshaller
extends org.iso_relax.verifier.impl.ForkContentHandler
implements SAXUnmarshallerHandler

Filter implementation of SAXUnmarshallerHandler.

This component internally uses a VerifierFilter to validate SAX events that goes through this component. Discovered error information is just passed down to the next component.

This will enable the implementation to validate all sources of SAX events in the RI - XMLReader, DOMScanner SAX events will go the VerifierFilter and then to the SAXUnmarshaller...


Method Summary
static ValidatingUnmarshaller create(com.sun.msv.grammar.Grammar grammar, SAXUnmarshallerHandler _core, com.sun.xml.bind.validator.Locator locator)
          Creates a new instance of ValidatingUnmarshaller.
 java.lang.Object getResult()
           
 void handleEvent(javax.xml.bind.ValidationEvent event, boolean canRecover)
          Reports an error to the user, and asks if s/he wants to recover.
 void startElement(java.lang.String nsUri, java.lang.String local, java.lang.String qname, org.xml.sax.Attributes atts)
           
 
Methods inherited from class org.iso_relax.verifier.impl.ForkContentHandler
characters, create, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 
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, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 

Method Detail

create

public static ValidatingUnmarshaller create(com.sun.msv.grammar.Grammar grammar,
                                            SAXUnmarshallerHandler _core,
                                            com.sun.xml.bind.validator.Locator locator)
Creates a new instance of ValidatingUnmarshaller.


getResult

public java.lang.Object getResult()
                           throws javax.xml.bind.JAXBException,
                                  java.lang.IllegalStateException
Specified by:
getResult in interface javax.xml.bind.UnmarshallerHandler
Throws:
javax.xml.bind.JAXBException
java.lang.IllegalStateException

handleEvent

public void handleEvent(javax.xml.bind.ValidationEvent event,
                        boolean canRecover)
                 throws org.xml.sax.SAXException
Description copied from interface: SAXUnmarshallerHandler
Reports an error to the user, and asks if s/he wants to recover. If the canRecover flag is false, regardless of the client instruction, an exception will be thrown. Only if the flag is true and the user wants to recover from an error, the method returns normally. The thrown exception will be catched by the unmarshaller.

Specified by:
handleEvent in interface SAXUnmarshallerHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String nsUri,
                         java.lang.String local,
                         java.lang.String qname,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.iso_relax.verifier.impl.ForkContentHandler
Throws:
org.xml.sax.SAXException


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.