Why not simply:
1. flow
cocoon.sendPage("mypipeline", {"myxml": mystring})
2. jxtemplate
<data>
${myxml}
</data>
3. sitemap
<map:generate type="jx" src="insertxml.jx"/>
Or more general:
cocoon.request.setAttribute("myxml", mystring);
cocoon.sendPage("mypipeline");
template:
${cocoon.request.getAttribute(cocoon.parameters.myxml)}
sitemap:
<map:generate type="jx" src="insertxml.jx">
<map:parameter name="myxml" value="myxml"/>
</map:generate>
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
> <map:match pattern="mypipeline">
> <map:generate type="customgen"/>
> <map:serialize type="xml"/>
> </map:match>
>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]