cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vadim.gritse...@verizon.net>
Subject RE: How do I generate XML in cocoon 2, as in cocoon 1.x?
Date Mon, 11 Feb 2002 13:50:33 GMT
> From: Marko Niinimaki [mailto:man@mail.cern.ch]
> 
> I have a little java program that returns a string that contains XML.
> In order to create a html output of it, I've used the following stuff:
> 
> <xsp:logic><![CDATA[
> String s = "<foo>hello</foo>";
> //of course, in real life, I call an external program that
> //generates s, like s = DataAccess.getLoginName..
> ]]>
> </xsp:logic>
> 
> 
> <xsp:expr>
>       this.xspParser.parse(
>         new InputSource(
>           new StringReader(s)
>         )
>       ).getDocumentElement()
> </xsp:expr>
> 
> How do I do the same stuff with cocoon 2?

In Cocoon 2.X, no xspParser is in XSPGenerator. IIRC, this was not
heavily advertised in Cocoon 1.X also. So if you need a parser it's now
your responsibility now to lookup it from the component manager and
release it (don't forget to release, best place is finally statement).

Then, I see couple of ways:

1. SAX: Use EmbeddedXMLPipe between this.contentHandler and parser to
filter out start/end document.
2. DOM: Parse string as DOM and then stream the DOM to the
this.contentHandler using DOMStreamer.

Vadim

> 
> Yours,
> Marko
> 


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message