01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.template.instruction;
18:
19: import java.util.Stack;
20:
21: import org.apache.cocoon.components.expression.ExpressionContext;
22: import org.apache.cocoon.template.environment.ErrorHolder;
23: import org.apache.cocoon.template.environment.ExecutionContext;
24: import org.apache.cocoon.template.environment.ParsingContext;
25: import org.apache.cocoon.template.script.Invoker;
26: import org.apache.cocoon.template.script.event.Event;
27: import org.apache.cocoon.template.script.event.StartElement;
28: import org.apache.cocoon.xml.XMLConsumer;
29: import org.xml.sax.Attributes;
30: import org.xml.sax.SAXException;
31: import org.xml.sax.SAXParseException;
32:
33: /**
34: * @version SVN $Id: EvalBody.java 449189 2006-09-23 06:52:29Z crossley $
35: */
36: public class EvalBody extends Instruction {
37: public EvalBody(ParsingContext parsingContext, StartElement raw,
38: Attributes attrs, Stack stack) {
39: super (raw);
40: }
41:
42: public Event execute(final XMLConsumer consumer,
43: ExpressionContext expressionContext,
44: ExecutionContext executionContext,
45: MacroContext macroContext, Event startEvent, Event endEvent)
46: throws SAXException {
47: try {
48: Invoker.execute(consumer, expressionContext,
49: executionContext, null,
50: macroContext.getBodyStart(), macroContext
51: .getBodyEnd());
52: } catch (Exception exc) {
53: throw new SAXParseException(exc.getMessage(),
54: getLocation(), exc);
55: } catch (Error err) {
56: throw new SAXParseException(err.getMessage(),
57: getLocation(), new ErrorHolder(err));
58: }
59: return getEndInstruction().getNext();
60: }
61: }
|