On Wed, Dec 10, 2008 at 10:38 AM, Jaroslav Pullmann
<[EMAIL PROTECTED]> 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.
>
<snip/>

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

  http://commons.apache.org/scxml/guide/datamodel.html

Source is here, for example (trunk version):

  http://commons.apache.org/scxml/xref/org/apache/commons/scxml/Builtin.html


>  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 ?
>
<snap/>

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')"/>
>
<snip/>

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
fragmented):

  
http://svn.apache.org/repos/asf/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-03.xml

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 "/>
>
<snap/>

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.

-Rahul

[1] http://commons.apache.org/scxml/issue-tracking.html


>  Many thanks !
>   Jaro
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to