// Javadoc inherited.
public Object startElement(
DynamicProcess dynamicProcess, ExpandedName element,
Attributes attributes) throws SAXException {
XMLPipelineContext pipelineContext = dynamicProcess.getPipelineContext();
ExpressionContext context = pipelineContext.getExpressionContext();
// Get the expr attribute.
String expr = attributes.getValue("expr");
if (expr == null) {
forwardError(dynamicProcess,
"'expr' attribute must be specified on " + element);
} else {
ExpressionFactory factory = ExpressionFactory.getDefaultInstance();
ExpressionParser parser = factory.createExpressionParser();
try {
// Parse, and evaluate the expression.
Expression expression = parser.parse(expr);
Value value = expression.evaluate(context);
// Stream the value's contents into the process following the
// dynamic process. Don't do it into the dynamic process as
// that will cause any markup to get reevaluated.
value.streamContents(getTargetProcess(dynamicProcess));
} catch (ExpressionException e) {
dynamicProcess.fatalError(new XMLPipelineException(
"Error parsing '" + expr +
"' from expr attribute on " + element,
pipelineContext.getCurrentLocator(), e));
}
}
return null;
}