You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bert Van Kets <be...@visitronics.be> on 2001/12/20 16:49:05 UTC

Translating XML from memory instead of disk

Hi Cocooners,
I'd like to create an HTML report from data stored in a database.
If I create an XML document in memory, how do I go about having it 
translated with Cocoon2 to my HTML report?
Do I need to create a generator, or can I just add something to the sitemap 
so that the source for the XML is not a file, but an object in memory?  Do 
I need to use a SAX parser or can I use a DOM parser too?
Can anybody direct me in the right direction please?
Thanks,
Bert


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Translating XML from memory instead of disk

Posted by David Rosenstrauch <da...@dti.net>.
Since your requirement is only "create an HTML report from data stored in a database" I guess I'd suggest not creating an XML document in memory as that can be a bit of a space hog and inefficient.  I'd prefer sticking with the SAX model that C2 uses.

So in that spirit, I'd recommend this:

1) either:
         * Write an XSP page (which is a generator) with esql tags in it to read from the database and then generate whatever xml output you need

         or

         * Write an XML document with a sql query in it and then run the SQL transformer against it to read from the database

2) run a stylesheet on the results to transform the xml into html

3) serialize as HTML


If you do absolutely have to create an XML document in memory, that can be dealt with too.  You can write an XSP page to handle writing XML documents/fragments to the Cocoon pipeline.

If I haven't answered your question well, then please clarify a bit more what you're looking for.


DR


At 04:49 PM 12/20/01 +0100, you wrote:
>Hi Cocooners,
>I'd like to create an HTML report from data stored in a database.
>If I create an XML document in memory, how do I go about having it translated with Cocoon2 to my HTML report?
>Do I need to create a generator, or can I just add something to the sitemap so that the source for the XML is not a file, but an object in memory?  Do I need to use a SAX parser or can I use a DOM parser too?
>Can anybody direct me in the right direction please?
>Thanks,
>Bert


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>