protected final void spawnHandlerFromLeaveAttribute(
      UnmarshallingEventHandler unm, int memento, String uri, String local, String qname)
      throws SAXException {

    context.pushContentHandler(unm, memento);
    unm.leaveAttribute(uri, local, qname);
  }
  protected final Element spawnWildcard(
      int memento, String uri, String local, String qname, Attributes atts) throws SAXException {
    UnmarshallingEventHandler ueh =
        context.getGrammarInfo().createUnmarshaller(uri, local, context);

    if (ueh != null) {
      context.pushContentHandler(ueh, memento);
      ueh.enterElement(uri, local, qname, atts);
      return (Element) ueh.owner();
    } else {
      // if no class is available to unmarshal this element, discard
      // the sub-tree by feeding events to discarder.
      context.pushContentHandler(new Discarder(context), memento);
      context.getCurrentHandler().enterElement(uri, local, qname, atts);
      return null; // return null so that the discarder will be ignored
    }
  }
 protected final void unexpectedEnterElement(
     String uri, String local, String qname, Attributes atts) throws SAXException {
   // notify the error
   reportError(Messages.format(Messages.UNEXPECTED_ENTER_ELEMENT, uri, local), true);
   // then recover by ignoring the whole element.
   context.pushContentHandler(new Discarder(context), state);
   context.getCurrentHandler().enterElement(uri, local, qname, atts);
 }
  protected final void spawnHandlerFromEnterElement(
      UnmarshallingEventHandler unm,
      int memento,
      String uri,
      String local,
      String qname,
      Attributes atts)
      throws SAXException {

    context.pushContentHandler(unm, memento);
    unm.enterElement(uri, local, qname, atts);
  }
  //
  //
  // spawn a new child object
  //
  //
  private UnmarshallingEventHandler spawnChild(Class clazz, int memento) {

    UnmarshallableObject child;
    try {
      child = (UnmarshallableObject) clazz.newInstance();
    } catch (InstantiationException e) {
      throw new InstantiationError(e.getMessage());
    } catch (IllegalAccessException e) {
      throw new IllegalAccessError(e.getMessage());
    }

    UnmarshallingEventHandler handler = child.createUnmarshaller(context);
    context.pushContentHandler(handler, memento);
    return handler;
  }
  protected final void spawnHandlerFromText(UnmarshallingEventHandler unm, int memento, String text)
      throws SAXException {

    context.pushContentHandler(unm, memento);
    unm.text(text);
  }