On 27 Mar 2010, at 18:05, David Hoffer wrote:

Hi David

> Thanks for that clarification.  In my case I don't have XML, rather I
> just have some calculated data with descriptions.  So I'd me making
> XML just to satisfy tools.  

Well, FOP is an XML application, so you would not get away without using some 
form of XML here. OTOH, the benefits of having an XML representation are that 
you would suddenly have a massive amount of tools/plugins available which 
'know' how to handle your data.

> I realize this is getting off topic for
> this group...but what I really want is a Java tool that can take POJOs
> and generate HTML and/or PDF.

Just to avoid misunderstandings: note that you do not have to create a 
/physical/ XML file to transform Java objects to PDF with FOP. Quite on the 
contrary, unless there is a good reason to create a separate file, that would 
be unnecessary overhead.
See the 'project team' example that comes with FOP. What happens there is a 
conversion from a Java object structure to SAX events. Those events are then 
sent through a fairly simple stylesheet and the resulting XSL-FO is fed to FOP, 
without writing an intermediate file to disk.
There are tools/libraries available that can convert POJO to XML on a generic 
basis (search for JAXB, Castor XML...). 
If your data is in the form of a Java Bean then you certainly will not have to 
reinvent the light-bulb here.

Once you were to use that approach to use FOP to generate PDF from your POJOs, 
then it could be only a very small effort (depending on the structure of your 
data) to write a second stylesheet to handle the transformation to HTML.

One thing you will definitely not escape when going this route is the need to 
learn basic XSLT. Benefit here is that this is a skill that can be applied for 
any form of XML-to-XML transformation.

At any rate, chances are that, if you do find a tool that does both the 
conversions you want to do, it will likely use XML in the background anyway...



Regards

Andreas Delmelle
---


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

Reply via email to