You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Geoff Howard <co...@leverageweb.com> on 2003/08/25 20:56:47 UTC
Re: Writing my own Producer to generate dynamic XML- How do I pas
s parameters to a custom generator that extends Abstract Generator
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:jheinicke@virbus.de]
> Sent: Thursday, August 21, 2003 6:48 PM
> To: users@cocoon.apache.org
> 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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org