Project

Profile

Help

transforming to SAXResult

Added by Anonymous over 15 years ago

Legacy ID: #5925580 Legacy Poster: pvallone (pvallone)

Hi, I am currently working in the Apache FOP trunk, trying to change the default xslt processor JAXP Transformer to Saxon 9.1. From what I understand, the FOP processor expects a SAXResult in order to start the F0-to-PDF process. In the below code, I get a java.lang.NullPointerException being thrown from an FOPException. It appears that FOP is looking for an object, and my code is not producing anything. With that said, How do I know if the below code actually produces a SAXResult? // Result res = new SAXResult(fop.getDefaultHandler()); protected void transformTo(Result result) throws FOPException { try { System.out.println("[info] Using Saxon 9.1 as xslt transformer."); // Create a SAXSource from the input Source file Source src = createMainSource(); Source xsltSource = createXSLTSource(); // Set transformer to SAXON System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl"); // Set up input documents TransformerFactory tfactory = TransformerFactory.newInstance(); System.out.println(tfactory.getFeature(SAXResult.FEATURE)); // Does this factory support SAX features?s if (tfactory.getFeature(SAXResult.FEATURE)) { // Get a transformer in the normal way: Transformer transformer = tfactory.newTransformer(xsltSource); transformer.setErrorListener(this); // Do the transformation transformer.transform(src, result); } else { System.out.println( "Can't do " + "because tfactory is not a SAXTransformerFactory"); } } catch (Exception e) { throw new FOPException(e); } } Thanks in advance. Regards, Phil


Replies (1)

RE: transforming to SAXResult - Added by Anonymous over 15 years ago

Legacy ID: #5926341 Legacy Poster: pvallone (pvallone)

Nevermind....

    (1-1/1)

    Please register to reply