xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felipe Mendes" <felipe.men...@db.com>
Subject [bug??] buildFoTree(Document)
Date Thu, 04 Jan 2001 16:29:03 GMT

Hello,

I am trying to use the buildFoTree(Document) but I get a NullPointerException.
I have checked the Document I am passing as a parameter and it is OK.
I am currently using fop 0.15 which includes the changes proposed in the begining of November
in some messages regarding the buildFoTree(Document).

Can anyone help?
Below there is the error message I get and the code I use.

Thanks
Filipe

This is the error message:
java.lang.NullPointerException
        at java.util.Hashtable.get(Hashtable.java:320)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:253)
        at org.apache.fop.apps.Driver.buildFOTree(Driver.java:360)

This is how my code looks like (most of it is based on XalanCommandLine.java):
...
try
    {
      XSLTInputSource xmlSource = new XSLTInputSource (mXMLDocument);

      //Create a DOM instance and pass it into the XSLTResultTarget
      // it will then go into the builtFOTree as a parameter
      Document mDoc = (Document)Class.forName("org.apache.xerces.dom.DocumentImpl").newInstance();

      //This is to write the tranformation into a DOM document
      XSLTResultTarget xmlResult = new XSLTResultTarget(mDoc);

      // Perform the transformation, the null is here because there has already been
      // performed a setStylesheet
      mXSLTProcessor.process(xmlSource, null, xmlResult);

      //set Driver methods to start Fop processing
      Driver driver = new Driver();
      driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer","");
      driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
      driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
      driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
      driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");

      //The output will be the OutputStream
      PrintWriter pwriter = new PrintWriter(pOut);
      driver.setWriter(pwriter);
      try
     {
           driver.buildFOTree((Document)xmlResult.getNode());
      }
      catch (FOPException e)
      {
        System.out.println("****FOPException:" + e.getMessage());
      }

      driver.format();
      driver.render();
      System.out.println("******** END of Transformation ********");
    }
    catch (Exception e)
    {
      System.out.println("****Exception: ");
      e.printStackTrace();
    }
...


--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie
nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren
Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.



Mime
View raw message