commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Ravot <>
Date Thu, 05 Jun 2008 07:26:15 GMT
I'm a perfect newbie to sxcml, so i'm probably asking stupid questions !

I'm trying to get access to the content of a datamodel from within the 
scxml document and a custom action :
Here is the dummy state machine:

     <scxml xmlns="" version="1.0"
         xmlns:mc="http://com.mccsoft.scxml/action" initialstate="start">
         <!--  Defining global data  -->
             <data name="timeout" expr="1" />
             <data name="counter" expr="1" />
             <data name="poolconfiguration">
         <!-- State machine starts here -->
         <state id="start">
                     expr="Data(poolconfiguration, 'foo/dir')"
             <transition target="now_waiting" />
         <state id="now_waiting">
                 <log expr="Counter is now counter" />
                 <mc:wait timeoutName="timeout" conf="poolconfiguration"/>
                 <assign name="counter" expr="counter +1" />
                     expr="'Timeout is ' + timeout + ' Counter is ' + 
counter " />
             <transition target="now_waiting" />


Regarding execution environment everything is copied from samples  using 
Jexl :

             exec = new SCXMLExecutor(new JexlEvaluator(),
                     new SimpleDispatcher(), new SimpleErrorReporter());
             exec.setRootContext(new JexlContext());

I've got a custom action <mc:wait ...> that get the name of the data 
entry to inspect...
Within the execute of the action i'm trying to do roughly but with java 
the equivalent of
<log expr="Data(poolconfiguration, 'foo/dir')" />

                     scInstance.getRootContext(), "Data(" + conf + 

My objective is to be able to access sub elements of a defined data (in 
this case poolconfiguration/foo/dir) of a top level datamodel.
and that either by scxml script or within custom action.

Unfortunately, none of those evaluation is returning the expected "toto".

I got in the log :
1922 [main] DEBUG org.apache.commons.jexl.ExpressionFactory  - Parsing 
expression:, poolconfiguration, 'foo/dir');
4500 [main] WARN org.apache.commons.scxml.Builtin  - Data(): No nodes 
matching the XPath expression "foo/dir", returning null

126125 [main] DEBUG org.apache.commons.scxml.Builtin  - Turning off 
namespaced XPath evaluation since no namespace information is available 
for path: foo/dir
126140 [main] WARN org.apache.commons.scxml.Builtin  - Data(): No nodes 
matching the XPath expression "foo/dir", returning null

(for the custom action).

The strange point is that, after debugging this sample, it appeared that 
the poolconfiguration node is correctly extracted by the Data 
expression. I mean the datanode found
in the _builtin seems ok (with childs, sieblings...),
but this piece of code  (
result = XPathAPI.selectNodeList(dataNode, path);
returns an empty list.

It is most obvious (to everybody except me) that i've probably spelled 
the XPATH in an incorrect way,
but i've tried may path without success ( '//dir', '/data/foo/dir', 

So any help or idea is welcomed !!!!

By advance thanks.

P. Ravot.

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

View raw message