use of org.apache.cocoon.pipeline.component.sax.XMLConsumerAdapter in project sling by apache.
the class SlingTransformer method setXMLConsumer.
@Override
protected void setXMLConsumer(XMLConsumer consumer) {
TransformerHandler transformerHandler;
try {
transformerHandler = this.createTransformerHandler();
} catch (Exception ex) {
throw new RuntimeException("Could not initialize transformer handler.", ex);
}
final Map<String, Object> map = this.getLogicSheetParameters();
if (map != null) {
final Transformer transformer = transformerHandler.getTransformer();
for (Entry<String, Object> entry : map.entrySet()) {
transformer.setParameter(entry.getKey(), entry.getValue());
}
}
final SAXResult result = new SAXResult();
result.setHandler(consumer);
// According to TrAX specs, all TransformerHandlers are LexicalHandlers
result.setLexicalHandler(consumer);
transformerHandler.setResult(result);
super.setXMLConsumer(new XMLConsumerAdapter(transformerHandler, transformerHandler));
}
Aggregations