commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <>
Subject Re: [SCXML] Help with Data()
Date Wed, 10 Dec 2008 20:06:00 GMT
On Wed, Dec 10, 2008 at 10:38 AM, Jaroslav Pullmann
<> wrote:
>  Dear all,
>  could you please give me a short hint on these questions ?
>  1) where to find documentation and source code for the "Data"-function for
> JEXL evaluator ?
>     I need to clarify which subset of XPath is supported.

There is some documentation of this page (towards the bottom):

Source is here, for example (trunk version):

>  2) there is no "name" attribute on <data> in current working draft, but
> Data() depends on it:
>      a) <data ID="foo"><foo>bar</foo></data>
>      b) <data name="foo"><foo>bar</foo></data>
>    the action <log expr="Data(foo,'node()')"/>
>    - throws an error for a: Data(): Cannot evaluate an XPath expression in
> the absence of a context Node
>    - returns "bar" for b)
>   Will the Data() implementation be adapted to the spec ?

In this case, it happens to be the other way around :-)

The casing of the ID attribute (all uppercase) in the draft was
unfortunate, and this has been discussed (and in all likelihood will
change to lowercase in the next draft). So, please use lowercase i.e.

  <data id="foo"><foo>bar</foo></data>

>  3) How to address nodes in a specific namespace via Data() ?
>      <data name="foo"><f:foo xmlns:f="fooNS"><baz>bar</baz></f:foo></data>
>      <!-- how to address f:foo ? -->
>      <log expr="Data(foo,'foo')"/>

I'm running out of time for email, so let me point to a fairly
comprehensive test case SCXML document that demonstrates use of
namespace prefixes in XPath expressions (the bottom line is prefixes
in an expression are resolved based on the enclosing namespace
declarations at the location where the expression occurs in the
document -- and so these prefixes may be different from the prefixes
specified in the <data>). Here is the test document (long URL, may get

Please feel free to bring up anything that isn't clear after going
through that test document.

>  4) assign supports static source-URLs via @src. Is there a way to supply an
> srcexpr,
>  or what would be the recommended way to perform and store XML data from
> parametrized GET-requests ?
>  broken example:
>    <data ID="MyId">3q495</data>
>    <assign location="Data(test,'response')" expr="
> 'http://localhost:8080/exist/ess/queries/getData.xqy?id=' + MyId "/>

I think the src attribute value should be evaluated as an expression
(that way, there isn't any need for another srcexpr attribute and
static URLs / string attribute values can be surrounded by single
quotes if needed). This will cover usecases as illustrated by your
example above.

Please open an enhancement request in JIRA [1] so we remember this, thanks.



>  Many thanks !
>   Jaro

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message