I don't know if this will help but if you are parsing with XSLT first you could use Xalan or Saxon to grab the data from the db. Xalan has an extension that you can use easy enough but Saxon's extension can only be used from the command line. Now to take it one step further you could write your own Java/XSLT function to do this but that is only if you have the skills or someone you know.
Marijan (Mario) Madunic Publishing Specialist New Flyer Industries -----Original Message----- From: Martin Jacobson [mailto:[email protected]] Sent: Thursday, February 11, 2010 3:35 AM To: [email protected] Subject: Re: Populating data dynamically from the DB using Apache FOP Well, theoretically you can drop the ResultSet into the Velocity context and iterate over it in the template, which is certainly the simplest way - personally, I prefer to create a List of some Bean class and iterate over that instead. But then, I'm old, cynical, and paranoid! M On 11 February 2010 10:41, RithanyaLaxmi <[email protected]> wrote: > > Thanks Martin, how to fill the data from the database for the placeholders > in temp.xml? Is it the data or the ResultSet needs to be converted to a XML > format. My question is ,similar to Jasper reports is there any API (eitheir > DOM or FOP) which takes the ArrayList (contains the data from DB) using the > API pass the arraylist with XML (temp.xml) which will eventually replace the > placeholder with the data (from the arraylist). Is it possible? > > Martin Jacobson wrote: >> >> 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 >> <[email protected]> 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: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> >> >> -- >> From my MacBook Pro >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >> > > -- > View this message in context: > http://old.nabble.com/Populating-data-dynamically-from-the-DB-using-Apache-FOP-tp27542925p27543891.html > Sent from the FOP - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- >From my MacBook Pro --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] -------------------------------------------------------------------- Please consider the environment before printing this e-mail. CONFIDENTIALITY STATEMENT: This communication (and any and all information or material transmitted with this communication) is confidential, may be privileged and is intended only for the use of the intended recipient. If you are not the intended recipient, any review, retransmission, circulation, distribution, reproduction, conversion to hard copy, copying or other use of this communication, information or material is strictly prohibited and may be illegal. If you received this communication in error or if it is forwarded to you without the express authorization of New Flyer, please notify us immediately by telephone or by return email and permanently delete the communication, information and material from any computer, disk drive, diskette or other storage device or media. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
