Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 78357 invoked from network); 4 Jun 2005 19:16:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jun 2005 19:16:48 -0000 Received: (qmail 53409 invoked by uid 500); 4 Jun 2005 19:16:41 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 53385 invoked by uid 500); 4 Jun 2005 19:16:41 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 53368 invoked by uid 99); 4 Jun 2005 19:16:41 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=FORGED_RCVD_HELO,SPF_HELO_FAIL,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of zbomert@dominikanie.pl designates 80.241.128.26 as permitted sender) Received: from tx.twins.pl (HELO tx.mail.twinsnet.pl) (80.241.128.26) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 04 Jun 2005 12:16:40 -0700 Received: from rx.twins.pl (rx.mail.twinsnet.pl [80.241.128.70]) by tx.mail.twinsnet.pl (8.12.8/8.x) with SMTP id j54JGaf9009971 for ; Sat, 4 Jun 2005 21:16:36 +0200 Message-ID: <42A1FE14.8030906@dominikanie.pl> Date: Sat, 04 Jun 2005 21:16:36 +0200 From: Zbigniew Bomert OP User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050417) X-Accept-Language: en-us, en MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: Injecting a String XML document into a pipeline References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Received-SPF: pass (tx.mail.twinsnet.pl: 80.241.128.70 is whitelisted) receiver=tx.mail.twinsnet.pl; client-ip=80.241.128.70; helo=rx.twins.pl; envelope-from=zbomert@dominikanie.pl; x-software=spfmilter 0.95 http://www.acme.com/software/spfmilter/ with libspf2; Received-SPF: none X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Why not simply: 1. flow cocoon.sendPage("mypipeline", {"myxml": mystring}) 2. jxtemplate ${myxml} 3. sitemap Or more general: cocoon.request.setAttribute("myxml", mystring); cocoon.sendPage("mypipeline"); template: ${cocoon.request.getAttribute(cocoon.parameters.myxml)} sitemap: zb Jorg Heymans wrote: > Sebastien Arbogast wrote: > > >>It depends on what you mean by "put the string in the request scope". >>I don't really understand how to translate that in code. Could you >>explain ? > > > 1) Flow > // mystring contains your xml > cocoon.request.setAttribute("myxml", mystring); > // now forward to pipeline > cocoon.sendPage("mypipeline"); > > 2) Custom generator pipeline > > > > > > 3) in your custom generator > - grab the "myxml" from request scope in setup(). You can get the > request object from the objectModel map. > - in generate() you do something like > XMLReader parser = XMLReaderFactory.createXMLReader( > "org.apache.xerces.parsers.SAXParser"); > parser.setContentHandler(this.contentHandler); > parser.parse(new InputSource(new BufferedInputStream( > new ByteArrayInputStream(this.myXml.getBytes())))); > > I've seen people asking for this quite often. This little snippet is key > in understanding how to send xml content from a string or byte[] down > the pipeline. It probably warrants an entry in the FAQ under "How to > write my own generator" , but i'll leave that one up to you ;-) > > > HTH > Jorg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org