You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Wannheden, Knut" <kn...@paranor.ch> on 2002/12/12 11:46:43 UTC

[jelly] xml pipeline

I just read the new article about the Jelly XML pipeline at
http://jakarta.apache.org/commons/sandbox/jelly/pipeline.html.

It is stated that a Jelly Tag can choose how to invoke its body.  So it
could (amongst other things) evaluate its body based on some condition or
parse its body into some structure.  This seems to suggest that these are
two completely different modes of operation.  But AFAICT, the second usage
(parse the body) requires it to be evaluated first.  Wouldn't it be useful
if a Tag could decide to parse its body in "raw" format (no evaluation of
it) or get the body as XML (DOM or SAX)?

So for example in

<my:tag>
 <j:set var="x" value="y"/>
</my:tag>

the <my:tag/> would retrieve its body as a Script.  For this Script it could
either request the associated XML code or evaluate it (and optionally get
the output).

Cheers,

--
knut

Re: [jelly] xml pipeline

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Wannheden, Knut" <kn...@paranor.ch>
> I just read the new article about the Jelly XML pipeline at
> http://jakarta.apache.org/commons/sandbox/jelly/pipeline.html.
>
> It is stated that a Jelly Tag can choose how to invoke its body.  So it
> could (amongst other things) evaluate its body based on some condition or
> parse its body into some structure.  This seems to suggest that these are
> two completely different modes of operation.  But AFAICT, the second usage
> (parse the body) requires it to be evaluated first.  Wouldn't it be useful
> if a Tag could decide to parse its body in "raw" format (no evaluation of
> it) or get the body as XML (DOM or SAX)?
>
> So for example in
>
> <my:tag>
>  <j:set var="x" value="y"/>
> </my:tag>
>
> the <my:tag/> would retrieve its body as a Script.  For this Script it
could
> either request the associated XML code or evaluate it (and optionally get
> the output).

Actually a tag can get its body as a Script and walk it if it wishes. So it
could analyse the tags inside it and do wacky things if so desired.

Note that the XML pipeline features are one mode of operation, where an
inner tag can produce XML events and the outer tag can filter, transform or
consume the events in some way. Various other kinds of operation and
pipelines are possible.

Many tags just do stuff, like Ant tags that execute tasks or libraries like
SOAP, HTTP, JMS that invoke services or operations.

Also tags can interoperate directly in custom pipelines, like in JSP - a
child tag can find a parent tag of a certain type and can interoperate that
way. e.g. the <sql:query> tags can work with the outer <sql:dataSource> tag
to get the JDBC connection to use etc.

Finally tags can interoperate via variable scopes. So one tag may output a
variable and another can use it as input to its operations. This allows
cross-semantic pipelining (which sounds a wacky term I've just made up). In
other words, inside a single Jelly script I could run a piece of Jython code
to create some objects, which can then be used in an SQL query which the
results can be piped into a SOAP service, or passed into some Ant task, then
sent in a JMS message etc. i.e. different semantics (scripting languages,
XML piplines, Ant tasks, expression languages and various different
services) can all be mixed and matched in quite flexible ways.

This is very useful for building, integration testing and EAI types of
problems.

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