Search in sources :

Example 1 with XsltBuilder

use of org.apache.camel.builder.xml.XsltBuilder in project camel by apache.

the class XsltAggregationStrategy method initialize.

protected void initialize(CamelContext context) throws Exception {
    // set the default property name if not set
    this.propertyName = ObjectHelper.isNotEmpty(propertyName) ? propertyName : DEFAULT_PROPERTY_NAME;
    // initialize the XsltBuilder
    this.xslt = context.getInjector().newInstance(XsltBuilder.class);
    if (transformerFactoryClass != null) {
        Class<?> factoryClass = context.getClassResolver().resolveMandatoryClass(transformerFactoryClass, XsltAggregationStrategy.class.getClassLoader());
        TransformerFactory factory = (TransformerFactory) context.getInjector().newInstance(factoryClass);
        xslt.getConverter().setTransformerFactory(factory);
    }
    if (uriResolver == null) {
        uriResolver = new XsltUriResolver(context, xslFile);
    }
    xslt.setUriResolver(uriResolver);
    xslt.setFailOnNullBody(true);
    xslt.transformerCacheSize(0);
    xslt.setAllowStAX(true);
    configureOutput(xslt, output.name());
    loadResource(xslFile);
}
Also used : TransformerFactory(javax.xml.transform.TransformerFactory) XsltUriResolver(org.apache.camel.builder.xml.XsltUriResolver) XsltBuilder(org.apache.camel.builder.xml.XsltBuilder)

Aggregations

TransformerFactory (javax.xml.transform.TransformerFactory)1 XsltBuilder (org.apache.camel.builder.xml.XsltBuilder)1 XsltUriResolver (org.apache.camel.builder.xml.XsltUriResolver)1