Re: Populating data dynamically from the DB using Apache FOP

2010-02-11 Thread Simon Pepping
Read up on SAX parsers, in the JAXP documentation, which is part of the JEE documentation. In this case the XML file is only virtual. It is constructed by your code in the form of SAX parser events. This is a fairly basic manner to do things. I do not know the other suggestions such as Velocity te

RE: Populating data dynamically from the DB using Apache FOP

2010-02-11 Thread Mario Madunic
AM To: fop-users@xmlgraphics.apache.org 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

Re: Populating data dynamically from the DB using Apache FOP

2010-02-11 Thread Martin Jacobson
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 20

Re: Populating data dynamically from the DB using Apache FOP

2010-02-11 Thread RithanyaLaxmi
Thanks Simon, as per your comment i need to parse the Temp.xml (which contains the placeholder) using SAX and read the data from the resultset. But how can I merge or append the data reed from DB to the Temp.xml. Once i merge the data in place of the placeholder, the temp.xml should look like:-

Re: Populating data dynamically from the DB using Apache FOP

2010-02-11 Thread Simon Pepping
You can use SAX. Your app implements SAXParser and emits SAX events: contentHandler.startElement('header'); contentHandler.text('Sample Header'); etc. Similarly for your data from the DB. For example, read the ResultSet, and emit the appropriate SAX events. The total picture is then: data (SAXPa

Re: Populating data dynamically from the DB using Apache FOP

2010-02-11 Thread RithanyaLaxmi
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) usi

Re: Populating data dynamically from the DB using Apache FOP

2010-02-11 Thread Martin Jacobson
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