commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [jelly] Taglib best practices for nested elements?
Date Tue, 28 Jan 2003 13:47:49 GMT
From: "Paul Libbrecht" <>
> > parse its body into some DOM model or turn the XML events into some
> > kind of Java objects or other kind of data structure"
> > How can I do this? How could I implement my specious
> > JellyUtils.tagToDom4jElement() method? Tag.getBody() returns a Script,
> > from which I haven't figured out how to get a dom4j (or other)
> Well, look at the definition of XMLOutput (that sole parameter of all
> doTag methods). This is basically a SAX DocumentHandler and it is free
> to your tag to invoke its body with a different XMLOutput (you have to
> invoke it with something!).
> You should not try to interfere with the parsing itself: actually a
> script, can, in principle, run several times and only be parsed once.
> Moreover, interfering with the parsing itself would mean the following
> very sad fact: you would not be able to use any of the jelly facilities
> in there, like jexl-expressions, <core:forEach> and this kind of thing:
> they are run by the tags themselves and only the output should interest
> you.

The XMLOutput is designed so that you can parse this if you like in a Tag.
That way Tags can be filters, transformers, parsers, XML sources, pipelines
etc. Even though the Script may get parsed once and run multiple times, the
XML events sent to XMLOutput are dynamic including the <j:forEach> and
expressions and so forth.


View raw message