예제 #1
0
 public Event execute(
     XMLConsumer consumer,
     ExpressionContext expressionContext,
     ExecutionContext executionContext,
     MacroContext macroContext,
     Event startEvent,
     Event endEvent)
     throws SAXException {
   Iterator iter = getSubstitutions().iterator();
   while (iter.hasNext()) {
     Subst subst = (Subst) iter.next();
     char[] chars;
     if (subst instanceof Literal) {
       chars = ((Literal) subst).getCharArray();
       consumer.characters(chars, 0, chars.length);
     } else {
       JXTExpression expr = (JXTExpression) subst;
       try {
         Object val = expr.getNode(expressionContext);
         Invoker.executeNode(consumer, val);
       } catch (Exception e) {
         throw new SAXParseException(e.getMessage(), getLocation(), e);
       } catch (Error err) {
         throw new SAXParseException(err.getMessage(), getLocation(), new ErrorHolder(err));
       }
     }
   }
   return getNext();
 }
예제 #2
0
 public void performGeneration(Event startEvent, Event endEvent) throws SAXException {
   XMLConsumer consumer =
       new AttributeAwareXMLConsumerImpl(new RedundantNamespacesFilter(this.xmlConsumer));
   ((Map) expressionContext.get("cocoon")).put("consumer", consumer);
   Invoker.execute(
       consumer,
       this.expressionContext,
       new ExecutionContext(this.definitions, this.scriptManager, this.manager),
       null,
       startEvent,
       null);
 }