commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Brandt <s...@fuzzymagic.com>
Subject Re: [jelly] Eval complex xml pipline?
Date Tue, 25 Feb 2003 16:44:40 GMT
Thanks and well, unless I'm mistaken it might be even easier than that. 
Though I might be doing this the lazy way, it seems to
me that we can somewhat follow what the ParseTag and it's fellows have 
done, and do something like this:

    public void doTag(XMLOutput output) throws 
MissingAttributeException, JellyTagException {
        final String THIS_METHOD = "doTag";
        JellyContext context = getContext();
        context.setInherit(true);
        context.setExport(true);
        XMLParser xp = new XMLParser();
        xp.setContext(context);
        try {
            XMLOutput newOutput = 
XMLOutput.createXMLOutput(xp.getXMLReader());
            invokeBody(newOutput);
            Script script = xp.getScript();
            _log.test(THIS_METHOD,script.toString());
            script.compile();
            script.run(context,output);
        } catch (SAXException e) {
            new JellyTagException(e);
        } catch (JellyException e) {
            new JellyTagException(e);
        }
    }

Though at the moment it looks like there's a variable visibility issue. 
Variables declared in the body script don't seem to be set. I'm still 
looking though.

- Sean

Wannheden, Knut wrote:

> 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?
>
> -- 
> knut
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message