commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Arauz (JIRA)" <>
Subject [jira] Commented: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole <data> element
Date Thu, 13 Mar 2008 10:21:46 GMT


Javier Arauz commented on SCXML-69:

I agree regarding new Data() variants. Actually what I'd like to see is full support for standard
XPath without the hassle of going through the Data() artifact.

In my example data model, data element 'foo' is realized by the parser as a degenerate XML
tree with only one leaf node, specifically a text node initially containing the string value

According to the latest W3C latest draft, expressions in attribute 'expr' in <data>
elements may yield any value,  i.e. it does not necessarily have to be a proper XML tree.
Non-XML-tree values are realized as degenerate XML trees, as described in the commons SCXML

Using <cs:var> as you suggest poses two problems: first, decreases the portability of
the scripts (which does not much in favor of an emerging technology); and second, deepens
into the deviation from the W3C standard, where one can refer to a whole <data> element
using the XPath "7data-name". 

I'd already tried Data(foo, '.') as you suggest, and it just doesn't work. I understand the
problem comes from the fact that the Data class that models a <data> element is not
an org.w3c.Node, but I'm not really sure about it.

> 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