xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Jacobson <jacobson.mar...@gmail.com>
Subject Re: Populating data dynamically from the DB using Apache FOP
Date Thu, 11 Feb 2010 08:09:36 GMT
This isn't, strictly speaking, a FOP issue, but since I have to do
something similar, I'll share my experience with you:
You have (at least) two options:
You can read your empty temp.xml file into a DOM, then manipulate the
DOM to fill in data from the database. I don't like this option. What
I do is to use Apache Velocity: I would have a Velocity template - the
equivalent of the empty temp.xml - which I would merge with my data
coming from the DB, to give me the completed temp.xml. This is much
easier to write and maintain.
HTH
Martin

Velocity : http://velocity.apache.org

On 11 February 2010 09:05, RithanyaLaxmi
<anantharaman.murugan@atlassystems.com> wrote:
>
> Hi,
>
> I using Apache FOP for PDF generation, i have the XML with header and footer
> information in the bodycontent i have a placeholder, for eg,
>
> Temp.xml
>
> <header>
> Sample Header
> </header>
> <bodycontent>
> [[bodycontent to be populated dynamically from DB]]
> </bodycontent>
> <footer>
> Sample Footer
> </footer>
>
> Temp.xsl,
>
> will have the XSL tags with the layout, styles, etc.
>
> Using Apache FOP API i need to fetch the data from the DB (using javax.sql),
> and replace the placeholder with the data in it and then use the XSL to
> apply the styles,etc to generate a PDF?
> I know the latter, i am not sure how to read the XML and replace the
> placeholder with the data fetched from DB using apache FOP. I know that
> Apache FOP uses SAX by default. Please do provide the code to parse the
> Temp.xml and replace the place holder with data using apache FOP. If there
> is any sample links please do provide that as well.
>
>
> Thanks,
> Rithu
> --
> View this message in context: http://old.nabble.com/Populating-data-dynamically-from-the-DB-using-Apache-FOP-tp27542925p27542925.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>



-- 
>From my MacBook Pro

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message