From: "Wannheden, Knut" <[EMAIL PROTECTED]>
> > > Would a tag like this be of interest to the Jelly project?
> > Would any
> > > of the
> > > existing tag libraries be a suitable "parent" for it? Jelly Core?
> > >
> > >
> > I know I'd find it useful ;) I'll look at doing an impl unless you've
> > something already going, Knut?
> >
>
> Go ahead by all means! :-) I know I'd have found it useful a few times
> myself. Wonder what's the best way to implement it... It'd almost be
> tempting to somehow get the XMLParser class to work as an XMLOutput, but
> that would require some bigger refactorings and would be quite hackish ;-)
> So subclassing XMLOutput is probably the way to go, no?
XMLOutput uses aggregation to work with any SAX ContentHandler or
LexicalHandler so no need to derive.
XMLParser is a ContentHandler and LexicalHandler. So you could do something
like this in pseudo code
public class EvalTag extends TagSupport {
private String var;
public void doTag(XMLOutput output) throws JellyTagException {
XMLParser parser = new XMLParser();
XMLOutput newOutput = new XMLOutput( parser );
// invoke body, redirecting SAX events into the Jelly parser
invokeBody( newOutput );
Script script = parser.getScript();
if (var != null) {
context.setVariable(var, script);
}
else {
// lets just execute the new script
script.run(context, output);
}
}
}
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]