commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <rahul.akol...@gmail.com>
Subject Re: [SCXML] problems with Data() function in Jexl
Date Mon, 10 Dec 2007 16:52:25 GMT
On 12/8/07, Sudeep Gandhe <gandhe@usc.edu> wrote:
> I tried the following scxml file with the StandaloneJexlExpressions. I don't get the
correct value for "Data(d, '//tar/@name')". Can you explain, what's wrong ?
>
<snip/>

We use some Xalan APIs internally to be able to resolve prefixes in
XPath expressions (since XPath expressions in SCXML documents can have
different context nodes, say <assign>, <log> etc. and hence different
prefixes, than the <data>s they refer to).

It is not immediately evident why the behavior you describe is only
seen when a combination of descendent-or-self and attribute axes are
used in the expression, I suspect this is either:
a) A bug or inconsistency in the Xalan processing (quite unlikely), or
b) A bug in the usage of Xalan APIs by Commons SCXML (more likely)

In any case, can you please attach a complete JUnit test case addition
to the Commons SCXML test suite that illustrates this, to the issue
tracker [1]? That will help us dig deeper. Thanks in advance.

-Rahul

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


> -- Sudeep
>
> SCXML file :
>
> <?xml version="1.0"?>
> <scxml xmlns="http://www.w3.org/2005/07/scxml"  version="1.0" initialstate="first">
>
> <datamodel>
>          <data name="d">
>                  <foo xmlns="">
>                          <bar>
>                                  <tar name="po">12</tar>
>                          </bar>
>                  </foo>
>          </data>
>          <data name="p">
>                  <one xmlns=""/>
>          </data>
> </datamodel>
>
> <state id="first">
>          <onentry>
>                  <log label="//tar" expr="Data(d, '//tar')"/>
>                  <!-- //tar/@name doesn't work -->
>                  <log label="//tar/@name" expr="Data(d, '//tar/@name')"/>
>                  <log label="foo/bar/tar" expr="Data(d, 'foo/bar/tar')"/>
>                  <!-- foo/bar/tar/@name  works -->
>                  <log label="foo/bar/tar/@name" expr="Data(d, 'foo/bar/tar/@name')"/>
>          </onentry>
>          <transition event="first.done" target="second"/>
>          <onexit>
>                  <assign location="Data(p, 'one')" expr="Data(d, '//bar')"/>
>          </onexit>
> </state>
>
> <state id="second" final="true">
>          <onentry>
>                  <log label="//tar" expr="Data(p, '//tar')"/>
>                  <!-- //tar/@name doesn't work -->
>                  <log label="//tar/@name" expr="Data(p, '//tar/@name')"/>
>                  <!-- one/tar/@name  works -->
>                  <log label="one/tar/@name" expr="Data(p, 'one/tar/@name')"/>
>          </onentry>
> </state>
> </scxml>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message