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
