David B. Bitton wrote:
> My current implementation passes the Driver into the Sax transform.  If the
> transform creates malformed xsl:fo, which is a possibility, the FOPException
> that is raised by FOP, is coming up to the top as an NPE and not the actuall
> message text.
> 
> For example, line 149 of org.apache.fop.pagination.PageSequence:
> 
>             throw new FOPException("page-sequence must be child of root, not
> "
>                                    + parent.getName());
> 
> is eventually thrown by the Transformer as a TransformerException, but when
> I getMessage(), it's an NPE.  Any idea why this would be?
> 
Are you sure you don't have something else which causes the parser
or the transformer to throw a NPE?

With the following code
  try {
    Driver driver=new Driver();
    driver.setRenderer(Driver.RENDERER_PDF);
    driver.setOutputStream(...);
    Transformer transformer=TransformerFactory.newInstance()
      .newTransformer(new StreamSource(new File("stuff.xsl")));
    transformer.transform(new StreamSource(new File("stuff.xml")),
     new SAXSource(driver.getContentHandler()));
  }
  catch( Exception e) {
    System.out.println(e.getMessage());
  }
I get the "page-sequence must be..." message without a problem, and
the caught Exception is a TransformerException.


J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to