JEXL built-in Data() function cannot return a reference to a whole <data> 
element
---------------------------------------------------------------------------------

                 Key: SCXML-69
                 URL: https://issues.apache.org/jira/browse/SCXML-69
             Project: Commons SCXML
          Issue Type: Improvement
    Affects Versions: 0.6, 0.5, 0.7, 0.8, 1.0
            Reporter: Javier Arauz
            Priority: Minor
             Fix For: 0.8


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.

Reply via email to