You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Rob Stote <RS...@whitehilltech.com> on 2003/02/28 15:07:19 UTC

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



Re: Entity Errors ?!?!?!

Posted by "Rodolfo M. Raya" <ro...@heartsome.net>.
On Fri, 2003-02-28 at 11:07, Rob Stote wrote:
> 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.

If your XML files have "&" everywhere, then your XML files are not
valid. You must replace all "&" with "&amp;" before processing them with
FOP.

Regards,
Rodolfo
-- 
Rodolfo M. Raya <ro...@heartsome.net>
Heartsome Holdings Pte. Ltd.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org