From: "Jeff Turner" <[EMAIL PROTECTED]> > On Tue, Oct 01, 2002 at 05:50:33PM +0100, James Strachan wrote: > > Hey Jeff > > > > From: "Jeff Turner" <[EMAIL PROTECTED]> > > > Is there any way in Jelly to save XML into a variable? It's possible to > > > <x:parse var="doc">, but then 'doc' is a Document, not XML. It is also > > > possible to output XML to a file via the <j:file> tag, but not to a > > > variable. > > > > Just a quick question; what do you want the XML output as. A large String? > > Yes. I'm trying to use Jelly XML output in an Ant script (Anteater, whose > maintainer is kicking himself for not switching to Jelly months ago;).
:-). I've been kicking myself for not looking closer at Anteater for a while too. > It > seemed simplest to store the XML in a variable. Though actually it might > be better to make a TaskContainer that plays with Jelly's XMLOutput > directly. Interesting. Maybe the JellyTask could play nicer with Ant and just output its XML in a way that Ant can use as a String or something. > > > Should I write my own tag? > > > > By all means if you like. Though maybe we can just patch the existing tags. > > > > I must admit the <j:file> name is a bit lousy, something like <j:output > > file="foo.txt"> would have been better. > > > > We could refactor the <j:file> tag code right now to support something > > like.. > > > > <j:output stream="${response.getOutputStream()}"> > > <some> > > <x m="l"/> > > </some> > > <j:output> > > > > which would write the body of the <output> tag to the given stream or writer > > etc. This could help in HTTP / Anteater type environments where you have an > > OutputStream or Writer where you want the XML output to go to. > > Mmm, that would be useful (providing the caller can pass the stream into > Jelly somehow). All that it would require would be that the OutputStream/Writer is in the JellyContext, or an object capable of creating the stream is. So if the HttpServletResponse object where in the JellyContext as a variable called 'response' then the above example would just work. If Ant supported object variables, you could put (say) a URLConnection or whatnot in the Ant Project as a variable and then use it directly from a Jelly script as shown above. > Thanks, I'll have a play and see what works. Cool. Lemme know if there's anything we can do to make things easier from inside Anteater. James ------- http://radio.weblogs.com/0112098/ __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>