commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar (JIRA)" <>
Subject [jira] Resolved: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole <data> element
Date Wed, 12 Mar 2008 21:50:49 GMT


Rahul Akolkar resolved SCXML-69.

    Resolution: Won't Fix

I think this might require a different way of going about the snippet posted above, but I
believe we shouldn't be adding more Data() function variants.

Not sure what "bar" refers to in the line:

 <data name="foo" expr="'bar'"/>

As general comments:
 * <data> should contain XML nodes, which would happen here if "bar" pointed to one
 * For pieces of the data model that are not nodes, <cs:var> should be used instead,
where 'cs' is the Commons SCXML namespace

Separately, there is a way to obtain the root <data> element by using the current context
node '.' in the query string i.e. Data(foo, '.')

Its unclear how useful that operation is (given the best practice that <data> should
contain an XML "tree" rooted with an application-specific root element).

> JEXL built-in Data() function cannot return a reference to a whole <data> element
> ---------------------------------------------------------------------------------
>                 Key: SCXML-69
>                 URL:
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6, 0.7
>            Reporter: Javier Arauz
>            Priority: Minor
>   Original Estimate: 72h
>  Remaining Estimate: 72h
> There is no way with JEXL of building a Data() expression that refers to a whole <data>
element, only to one of its children.
> Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="/foo" expr="/myFoo/content"/>
> In theory, after running the above SCXML the 'foo' data element changes from value 'bar'
to 'Hi there!'.
> There is no equivalent to the above SCXML using JEXL, since no Data() expression yields
the root <data> element. This has the side effect that data elements as 'foo' above
are effectively constants, since once defined there's no way of changing them.
> The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin
that takes just two arguments: the namespaces in use and the name of the <data> element,
and returns an org.w3c.Node containing whatever that <data> element contains. Then you
could write:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message