cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: How to inject the result of an action into a generator
Date Wed, 26 Mar 2008 10:32:51 GMT
On Tue, 2008-03-25 at 21:49 -0400, Joerg Heinicke wrote:
> On 25.03.2008 18:46, shai200 wrote:
> 
> > This requirement is the primary function that I'll need from Cocoon,
> > otherwise it's not good for me and I'll have to find some other servlet
> > generating framework.
> 
> It's not that Cocoon does not support this functionality in general. 
> What we said so far only means you picked the wrong component types. 
> Actions are for different purpose than data generation. Look at Vadim's 
> post regarding the alternatives.
> 
> > What I require is an "Action Generator" (rather than the existing
> > FileGenerator) that takes XHTML output that a POJO (i.e. and Action class)
> > returns and then moves it down the pipeline.
> 
>  From what I understand you are looking for a component converting 
> Strings into XML without coping with the parsing - otherwise you could 
> just implement a generator. But even parsing is totally easy, an 
> implementation of your own generator could be:
> 
> InputSource source = new InputSource(new StringReader("<xmlString>");
> SAXParser parser = null;
> try {
>      parser = (SAXParser) manager.lookup(SAXParser.ROLE);
>      parser.parse(source, xmlConsumer);
> } finally {
>      manager.release(parser);
> }
> 
> xmlConsumer is available in a generator.

Actually as I understand the thread so far we need to point out that the
"<xmlString>" needs to have all the characteristics a valid xml document
has. I mean you need a wellformed "<xmlString>" since the Parser will
produce SAX events.

salu2
-- 
Thorsten Scherler                                 thorsten.at.apache.org
Open Source Java                      consulting, training and solutions


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message