Project

Profile

Help

RE: java.lang.NullPointerException while streaming ยป TEST.java

Gerben Abbink, 2014-04-25 14:56

 
import java.io.*;
import javax.xml.transform.stream.*;
import net.sf.saxon.*;
import net.sf.saxon.expr.parser.*;
import net.sf.saxon.lib.*;
import net.sf.saxon.s9api.*;

public class TEST{
public static void main(String[] args){
try{
Configuration configuration = new com.saxonica.config.EnterpriseConfiguration();
// exception if not commented
// no exception if commented.
configuration.setConfigurationProperty(FeatureKeys.OPTIMIZATION_LEVEL, String.valueOf(Optimizer.NO_OPTIMIZATION));
Processor processor = new Processor(configuration);
XsltCompiler compiler = processor.newXsltCompiler();
XsltExecutable executable = compiler.compile(new StreamSource("file:///E:/XML%20Examples/XSLT%20Streaming/Example1.xsl"));
XsltTransformer transformer = executable.load();
transformer.setDestination(new Serializer(new StringWriter()));
transformer.setSource(new StreamSource("file:///E:/XML%20Examples/XSLT%20Streaming/Example1.xml"));
transformer.transform();
System.out.println("OK");
}
catch(Exception e){
System.out.println("Exception");
}
}
}
    (1-1/1)