Paul,
There is already a class which will take the xml, xsl files and outpu a pdf!
There is also a batch file (if you or unix a shell script) which will do this for you.
It is is in your fop installation directory and is called fop.bat (fop.sh on unix).
This is for a standalone application. Are you trying to create a servlet which will 
out put PDF
files with the xml and xsl files as input?

Amit

Paul Kowlessar wrote:

> Hi,
>
> I have just downloaded FOP 0.20.2 and have included the appropriate jars
> into my classpath. To test my installation, I have created a simple
> program based on the code in the "Embedding FOP" page.  Here is the
> code:
> /********************************************/
> import java.util.*;
> import java.io.*;
> import java.io.FileOutputStream;
> import org.apache.fop.apps.*;
> import org.xml.sax.*;
> import org.apache.avalon.framework.logger.*;
> import org.apache.log.*;
>
> public class PDFTest
> {
>   public PDFTest()
>   {
>    Logger log = null;
>    Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
>    log = hierarchy.getLoggerFor("fop");
>    log.setPriority(Priority.WARN);
>
>    String xmlFile = "c:\\worktemp\\01M10_YVR_FA.xml";
>    String xslFile = "c:\\worktemp\\bidreport.xsl";
>    String pdfFile = "c:\\worktemp\\outFile.pdf";
>    FileOutputStream output = null;
>    try{
>        output = new FileOutputStream(pdfFile);
>        Driver driver = new Driver();
>        driver.setLogger(log);
>        driver.setRenderer(Driver.RENDER_PDF);
>        XSLTInputHandler inputHandler = new XSLTInputHandler(new
> File(xmlFile), newFile(xslFile));
>        org.xml.sax.XMLReader parser = inputHandler.getParser();
>        driver.setOutputStream(output);
>        driver.render(parser,inputHandler.getInputSource());
>    }catch (Exception ex){
>        ex.printStackTrace();
>    }
>   }
>
>  public static void main(String[] args)
>  {
>   PDFTest test = new PDFTest();
>  }
> }
> /*************************************************************/
>
> This file compiles with no problem.  However, when I try to run it the
> following errors are encountered:
>
> org.apache.fop.apps.FOPException
>         at
> org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:109)
>
>         at PDFTest.<init>(PDFTest.java:29)
>         at PDFTest.main(PDFTest.java:41)
>
> ---------
>
> java.lang.reflect.InvocationTargetException:
> org.apache.fop.apps.FOPException:
> javax.xml.parsers.FactoryConfigurationE
>         at
> org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:103)
>
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
>
>         at PDFTest.<init>(PDFTest.java:29)
>         at PDFTest.main(PDFTest.java:41)
>
> ---------
>
> ---------
>
> org.apache.fop.apps.FOPException:
> javax.xml.parsers.FactoryConfigurationError:
> com.sun.xml.parser.SAXParserFactoryImpl
>         at
> org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:103)
>
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
>
>         at PDFTest.<init>(PDFTest.java:29)
>         at PDFTest.main(PDFTest.java:41)
>
> ---------
>
> javax.xml.transform.TransformerConfigurationException:
> javax.xml.parsers.FactoryConfigurationError: com.sun.xml.parser
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:815)
>
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newXMLFilter(TransformerFactoryImpl.java:486)
>
>         at
> org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:84)
>
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
>
>         at PDFTest.<init>(PDFTest.java:29)
>         at PDFTest.main(PDFTest.java:41)
> ---------
> javax.xml.transform.TransformerException:
> javax.xml.parsers.FactoryConfigurationError:
> com.sun.xml.parser.SAXParserFac
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:813)
>
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newXMLFilter(TransformerFactoryImpl.java:486)
>
>         at
> org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:84)
>
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
>
>         at PDFTest.<init>(PDFTest.java:29)
>         at PDFTest.main(PDFTest.java:41)
> ---------
> org.xml.sax.SAXException: javax.xml.parsers.FactoryConfigurationError:
> com.sun.xml.parser.SAXParserFactoryImpl
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:771)
>
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newXMLFilter(TransformerFactoryImpl.java:486)
>
>         at
> org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:84)
>
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
>
>         at PDFTest.<init>(PDFTest.java:29)
>         at PDFTest.main(PDFTest.java:41)
> ---------
> org.xml.sax.SAXException: javax.xml.parsers.FactoryConfigurationError:
> com.sun.xml.parser.SAXParserFactoryImpl
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:771)
>
>         at
> 
>org.apache.xalan.processor.TransformerFactoryImpl.newXMLFilter(TransformerFactoryImpl.java:486)
>
>         at
> org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:84)
>
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
> org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
>
>         at PDFTest.<init>(PDFTest.java:29)
>         at PDFTest.main(PDFTest.java:41)
>
> Has anyone encountered this problem before?  If so, please reply with
> your solution.
> Thanks in advance.
>
> Cheers...Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to