Title: Entity Errors ?!?!?!

Hello:
I am a little new to this stuff so bear with me.
I am using FOP to render my files to PDF, and TIFF.

Enviro:
JDK 1.4.1
FOP 0.20.4

My flow, create a .fo file from the XSL, and XML, pass the .fo to the various renderers I have set up.

CODE:
  public void renderPDFFromFO(File in, File out) {
    try {
      FileOutputStream outStream = new FileOutputStream(out);
      Driver driver = new Driver(new InputSource(new FileInputStream(in)),
                                 outStream);
      driver.setRenderer(Driver.RENDER_PDF);
      driver.run();
    } catch(IOException ex) {
      ex.printStackTrace();
    } catch(FOPException ex) {
      ex.printStackTrace();
    }


I get the following error:
org.apache.fop.apps.FOPException: The entity name must immediately follow the '&' in the entity reference.

But, when I change my flow to the following,
Apply XML, XSL to create PDF everything works great,

No error and I get the PDF.

CODE: (this is test code, I sub out the tiff render when needed)

  public void renderPDF(File xmlFile, File xslFile, File outFile) {
    try {
      Driver driver = new Driver();
      driver.setLogger(logger);
      driver.setRenderer(Driver.RENDER_PDF);
        //driver.setRenderer(Driver.RENDER_PDF);
      InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
      XMLReader parser = inputHandler.getParser();
      driver.setOutputStream(new FileOutputStream(outFile));
      driver.render(parser, inputHandler.getInputSource());
    } catch(FileNotFoundException ex) {
      System.out.println("" + ex.getMessage());
    } catch(IllegalArgumentException ex) {
      System.out.println("" + ex.getMessage());
    } catch(FOPException ex) {
      System.out.println("" + ex.getMessage());
    }
  }

So I guess my question: is there ant way for the renderers to recognize, or any way in the creation of the .fo file to handle entity references. I am assuming that FOP creates a .fo file under the skin and then uses it to transform, I could be wrong, I am at an impasse here. The XML does have &'s scattered through out the file. Any help would be appreciated.


Rob


Reply via email to