You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Savino, Matt C" <Ma...@questdiagnostics.com> on 2001/09/19 22:33:04 UTC

Does render(dom) actually work?

Hello everyone. By any chance can someone point me to some example code
which uses render(dom)?  No matter what combination of driver methods or Fop
versions (.17,.19,.20.1) I use I seem to get the same error:

building formatting object tree
setting up fonts
java.lang.NullPointerException
        at java.util.Hashtable.get(Hashtable.java:320)
        at
org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:191)
        at
org.apache.fop.tools.DocumentReader.parse(DocumentReader.java:444)
        at org.apache.fop.apps.Driver.render(Driver.java:449)
        at FOtoPDF.applyFop(FOtoPDF.java:83)
        at FOtoPDF.main(FOtoPDF.java:24)

Here is the source I'm using under v.0.20.1:
      org.apache.fop.apps.Driver driver = new org.apache.fop.apps.Driver();
      driver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
      driver.setOutputStream(new FileOutputStream(pdfFilename));
      driver.setupDefaultMappings() ;
      driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
      driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
 
driver.addElementMapping("org.apache.fop.extensions.ExtensionElementMapping"
);
      driver.render(dom);

I have tried it with and without any of the mapping methods.

I am building the Dom object from a file. The sax input handler created from
the same file works fine in render(parser, inputSource). I have read through
the dev archives and found a few suggestions but none helped. Is there some
configuration I'm missing? Or did this "break a long time ago" as someone
suggested in the archives?

I am hoping to use FOP in a major production app, but if I can't solve this
I may not be able to. I am currently receiving a DOM object (a small report)
from some database access classes. I then perform an XSLT transform which
outputs my FO input as another DOM object. I suppose I could pipe the output
of that to SAX? I'd really rather not have to do anything klugy like
serialize it to a stream and then feed it in as SAX. But I'll consider
anything that doesn't cause too much of a performace hit. We definitely
don't want to have temp files sitting around, for a host of reasons.

Thank you very much for your help.

Matt Savino







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