W3C home > Mailing lists > Public > www-xsl-fo@w3.org > October 2001

Using a org.w3c.dom.Document as indata to the Driver

From: Erik Melkersson <melker@unit.liu.se>
Date: Thu, 04 Oct 2001 14:30:47 +0200
To: www-xsl-fo@w3.org
Message-id: <3BBC5677.E1851069@unit.liu.se>
Hi!

I would like to read a fo file to a DOM tree on startup.
Do some changes to it on runtime and then produce pdf and ps from it.

I am using version 0.20.1 of fop.

My try:

---
// Fetch xml -> dom tree
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
Document doc = docBuilder.parse(FOfilename);

//... some changes to the DOM tree shall be done here (but I aint doing
any changes yet

Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(new FileOutputStream());

driver.render(doc); // -> returns fault, se below

//driver.setInputSource(new DocumentInputSource(doc));
// -> gives the same fault

/*
  //This works (but it doesn't use the preparsed dom tree
  driver.setInputSource(new InputSource(aPDFfilename));
  driver.run();
*/
---

The error I get is:
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 Avi.main(Avi.java:61) (my file)


I can only find old examples where a method Driver.format() is used...
and they does not use dom trees as indata.

Thankful for any help!

 
__________________________
Erik Melkersson, UNIT
melker@unit.liu.se, 013-285794
http://www.unit.liu.se/
Received on Thursday, 4 October 2001 08:31:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:08 GMT