Anuja Gokhale wrote:
thanx. I was able to write my own custom generator that works with static
data.


I however need my generate to generate an XML document based on the user's
input (form data). How can I pass and retrieve request parameters to and
from my generator (My generator extends the AbstractGenerator..is this what
i should be using?)

Attached is the source for my simple generator...

public class MyGenerator extends AbstractGenerator {
  public void generate () throws IOException, SAXException,
    ProcessingException {
          RequestParameterModule requestData = new RequestParameterModule();
      String message = "<doc>" + requestData.getAttribute + "</doc>";

      XMLReader xmlreader = XMLReaderFactory.createXMLReader();
      xmlreader.setContentHandler(super.xmlConsumer);
      InputSource source = new InputSource(new StringReader(message));
      xmlreader.parse(source);
  }
}

http://cocoon.apache.org/2.1/tutorial/tutorial-generator.html has examples of retrieving request parameters. Feel free to ask specific questions if that doesn't make sense.


Geoff

-----Original Message-----
From: Joerg Heinicke [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:48 PM
To: [EMAIL PROTECTED]
Subject: Re: Writing my own Producer to generate dynamic XML


The component you search for is "generator" (http://cocoon.apache.org/2.1/userdocs/generators/generators.html). There are already different technologies generating XML from DB (http://cocoon.apache.org/2.1/userdocs/concepts/databases.html). Also search on http://wiki.cocoondev.org/ for more information.


Joerg

Anuja Gokhale wrote:


Hello,

My application needs to read information from a DB plus do other stuff and
then have this displayed in different views. For this, I was planning on
writing a Producer that generates my XML and then defining XSL transformer
to operate on this dynamic XML.

Here are my questions:
1) Should my producer implement the AbstractProducer interface (even

though


I may never use the HttpServletRequest and response objects to generate my
XML)
2) Where do I define my producer for cocoon? In the sitemap?
3) How can I ensure that this Producer gets called when I need to get my
dynamic XML data?


-Anuja


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



Reply via email to