5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.6-b27-fcs
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// Any modifications to this file will be lost upon recompilation of the source schema.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// Generated on: 2012.06.11 at 10:34:07 AM PDT
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkpackage com.sun.identity.saml2.jaxb.assertion.impl.runtime;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenkimport java.util.StringTokenizer;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport javax.xml.bind.Element;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport javax.xml.bind.ParseConversionEvent;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport javax.xml.bind.ValidationEvent;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport javax.xml.bind.helpers.ParseConversionEventImpl;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport javax.xml.bind.helpers.ValidationEventImpl;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport javax.xml.bind.helpers.ValidationEventLocatorImpl;
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenkimport org.xml.sax.Attributes;
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenkimport org.xml.sax.SAXException;
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenkimport com.sun.xml.bind.JAXBAssertionError;
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenkimport com.sun.xml.bind.unmarshaller.Messages;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk/**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Convenient default implementation of
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * {@link UnmarshallingEventHandler}
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * to minimize code generation.
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * <p>
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * For historical reasons, sometimes this type is used where
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk * {@link UnmarshallingEventHandler} should be used.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Once an exception is in the form of UnmarshalException, we consider
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * it to be already reported to the client app.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkpublic abstract class AbstractUnmarshallingEventHandlerImpl implements UnmarshallingEventHandler
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk{
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public AbstractUnmarshallingEventHandlerImpl(UnmarshallingContext _ctxt,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String _stateTextTypes ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.context = _ctxt;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.stateTextTypes = _stateTextTypes;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public final UnmarshallingContext context;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Text type of states encoded into a string.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * 'L' means a list state.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private final String stateTextTypes;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// methods that will be provided by the generated code.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // internal events
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void enterElement(String uri, String local, String qname, Attributes atts) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unexpectedEnterElement(uri,local,qname,atts);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void leaveElement(String uri, String local, String qname) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unexpectedLeaveElement(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public final void text(String text) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if(isListState()) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // in list state, we don't need to care about whitespaces.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // if the text is all whitespace, this won't generate a text event,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // so it would be just fine.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk StringTokenizer tokens = new StringTokenizer(text);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if( tokens.countTokens()==1 ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk handleText(text);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } else {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk while(tokens.hasMoreTokens())
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // the handler can be switched during the text processing,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // so the current handler has to be obtained inside the loop
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().text(tokens.nextToken());
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } else {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // otherwise process this token
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk handleText(text);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected void handleText(String s) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unexpectedText(s);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void enterAttribute(String uri, String local, String qname) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unexpectedEnterAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void leaveAttribute(String uri, String local, String qname) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unexpectedLeaveAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void leaveChild(int nextState) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.state = nextState;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Checks if the current state is marked as a list state.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final boolean isListState() {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return stateTextTypes.charAt(state)=='L';
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** Current state of this automaton. */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public int state;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// utility methods
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** Called when a RuntimeException is thrown during unmarshalling a text. */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected void handleUnexpectedTextException( String text, RuntimeException e ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // report this as an error
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( Messages.format(Messages.UNEXPECTED_TEXT,text), e, true );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Last resort when something goes terribly wrong within the unmarshaller.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected void handleGenericException( Exception e ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( e.getMessage(), e, false );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void dump() {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk System.err.println("state is :"+state);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private void reportError( String msg, boolean canRecover ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( msg, null, canRecover );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private void reportError( String msg, Exception nested, boolean canRecover ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.handleEvent( new ValidationEventImpl(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk canRecover? ValidationEvent.ERROR : ValidationEvent.FATAL_ERROR,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk msg,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk new ValidationEventLocatorImpl(context.getLocator()),
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk nested ), canRecover );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void unexpectedEnterElement( String uri, String local, String qname, Attributes atts ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // notify the error
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( Messages.format(Messages.UNEXPECTED_ENTER_ELEMENT, uri, local ), true );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // then recover by ignoring the whole element.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(new Discarder(context),state);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().enterElement(uri,local,qname,atts);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void unexpectedLeaveElement( String uri, String local, String qname ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( Messages.format(Messages.UNEXPECTED_LEAVE_ELEMENT, uri, local ), false );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void unexpectedEnterAttribute( String uri, String local, String qname ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( Messages.format(Messages.UNEXPECTED_ENTER_ATTRIBUTE, uri, local ), false );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void unexpectedLeaveAttribute( String uri, String local, String qname ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( Messages.format(Messages.UNEXPECTED_LEAVE_ATTRIBUTE, uri, local ), false );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void unexpectedText( String str ) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // make str printable
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk str = str.replace('\r',' ').replace('\n',' ').replace('\t',' ').trim();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk reportError( Messages.format(Messages.UNEXPECTED_TEXT, str ), true );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void unexpectedLeaveChild() throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // I believe this is really a bug of the compiler,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // since when an object spawns a child object, it must be "prepared"
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // to receive this event.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk dump();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throw new JAXBAssertionError(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk Messages.format( Messages.UNEXPECTED_LEAVE_CHILD ) );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * This method is called by the generated derived class
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * when a datatype parse method throws an exception.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected void handleParseConversionException(Exception e) throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if( e instanceof RuntimeException )
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throw (RuntimeException)e; // don't catch the runtime exception. just let it go.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // wrap it into a ParseConversionEvent and report it
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ParseConversionEvent pce = new ParseConversionEventImpl(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ValidationEvent.ERROR, e.getMessage(),
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk new ValidationEventLocatorImpl(context.getLocator()), e );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.handleEvent(pce,true);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// spawn a new child object
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private UnmarshallingEventHandler spawnChild( Class clazz, int memento ) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallableObject child;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk try {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk child = (UnmarshallableObject)clazz.newInstance();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } catch (InstantiationException e) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throw new InstantiationError(e.getMessage());
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } catch (IllegalAccessException e) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throw new IllegalAccessError(e.getMessage());
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler handler = child.createUnmarshaller(context);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(handler,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return handler;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final Object spawnChildFromEnterElement(Class clazz, int memento, String uri, String local, String qname, Attributes atts)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler ueh = spawnChild(clazz,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ueh.enterElement(uri,local,qname,atts);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return ueh.owner();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final Object spawnChildFromEnterAttribute(Class clazz, int memento, String uri, String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler ueh = spawnChild(clazz,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ueh.enterAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return ueh.owner();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final Object spawnChildFromText(Class clazz, int memento, String value)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler ueh = spawnChild(clazz,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ueh.text(value);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return ueh.owner();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // these methods can be used if a child object can be nullable
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final Object spawnChildFromLeaveElement(Class clazz, int memento, String uri, String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler ueh = spawnChild(clazz,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ueh.leaveElement(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return ueh.owner();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final Object spawnChildFromLeaveAttribute(Class clazz, int memento, String uri, String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler ueh = spawnChild(clazz,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ueh.leaveAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return ueh.owner();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final Element spawnWildcard( int memento, String uri, String local, String qname, Attributes atts )
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler ueh = context.getGrammarInfo().createUnmarshaller(uri,local,context);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if(ueh!=null) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(ueh,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk ueh.enterElement(uri,local,qname,atts);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return (Element)ueh.owner();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } else {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // if no class is available to unmarshal this element, discard
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // the sub-tree by feeding events to discarder.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler( new Discarder(context), memento );
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().enterElement(uri,local,qname,atts);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk return null; // return null so that the discarder will be ignored
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// spawn a new child handler.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// used for super class and RELAXNG interleave handling.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void spawnHandlerFromEnterElement(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler unm, int memento, String uri, String local, String qname, Attributes atts )
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(unm,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unm.enterElement(uri,local,qname,atts);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void spawnHandlerFromEnterAttribute(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler unm, int memento, String uri, String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(unm,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unm.enterAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void spawnHandlerFromFromText(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler unm, int memento, String value)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(unm,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unm.text(value);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void spawnHandlerFromLeaveElement(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler unm, int memento, String uri, String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(unm,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unm.leaveElement(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void spawnHandlerFromLeaveAttribute(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler unm, int memento, String uri, String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(unm,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unm.leaveAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void spawnHandlerFromText(
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk UnmarshallingEventHandler unm, int memento, String text )
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.pushContentHandler(unm,memento);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk unm.text(text);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk// revert to parent
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk//
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void revertToParentFromEnterElement(String uri,String local, String qname,Attributes atts)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.popContentHandler();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().enterElement(uri,local,qname,atts);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void revertToParentFromLeaveElement(String uri,String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.popContentHandler();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().leaveElement(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void revertToParentFromEnterAttribute(String uri,String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.popContentHandler();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().enterAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void revertToParentFromLeaveAttribute(String uri,String local, String qname)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.popContentHandler();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().leaveAttribute(uri,local,qname);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk protected final void revertToParentFromText(String value)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk throws SAXException {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.popContentHandler();
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk context.getCurrentHandler().text(value);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk}