Jeremias (or others),

I'm converting over at work to this method you're
describing below, using the embed sample you mention
below--everything is going well so far.

Question though:  For date and number types within the
various objects that represent the data, should I use
String datatypes instead because of the subsequent SAX
event handling, or will dates and floats/ints etc.
still work fine with this method?

Thanks,
Glen

--- Jeremias Maerki <[EMAIL PROTECTED]> wrote:

> I'd avoid creating XML by string concatenation. Too
> many things that can
> go wrong.
> 
> Please have a look at the embedding examples [1] in
> the FOP distribution.
> There's a particular example [2] that should fit
> nicely with your
> requirements after a few modifications. Instead of
> using a plain Java
> object as a data source you can just as easily
> create an XMLReader
> descendant [3] to create SAX events from a database
> result set. Using
> SAX events will free you from the necessity to
> handle many XML-specifics
> (like character escaping) if you use string
> concatenation. By piping the
> generated SAX events directly through to FOP [2] you
> also have a very
> fast system, as you don't have to parse the XML
> again that you created.
> 
> [1]
> http://xml.apache.org/fop/embedding.html#examples
> [2]
>
http://cvs.apache.org/viewcvs.cgi/xml-fop/examples/embedding/java/embedding/ExampleObj2XML.java?rev=1.4
> [3]
>
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-fop/examples/embedding/java/embedding/model/ProjectTeamXMLReader.java?rev=1.3
> 
> I hope that helps.
> 
> On 15.02.2005 02:36:58 Manisha Sathe wrote:
> > Initially i tested creating pdf using static
> xml/xsl file using
> > following dos prompt cmd - 
> >  
> > fop -xml myxml.xml -xsl myxsl.xsl -pdf mydoc.pdf
> > 
> > Now i want to generate xml/pdf on fly. User will
> specify search
> > criteria - depending on that i will pick up data
> from database.I want
> > to generate xml from this data and use it to
> create pdf file. 
> >  
> > What is normal practice to do this? 
> >  
> > 1)I am not too sure about how to create XML -
> whether use SAX/DOM or
> > just type it out as a string data 
> > 2)e.g If i generate XML o/p as a string - whether
> can i make use of
> > this XML String to generate pdf ? Or i need to
> write this in a file ?
> >  
> > Pls guide me, if anybody can share sample which
> shows creation of XML
> > and generate pdf from that - would be a greate
> help.
> 
> 
> Jeremias Maerki
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


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

Reply via email to