[SCXML] <assign> tag usage is giving location error

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[SCXML] <assign> tag usage is giving location error

Diptendu Dutta
Do simple assignments of the form <assign location="id" expr="value" />
work in commons scxml?

I have this state machine description:

<scxml xmlns="http://www.w3.org/2005/07/scxml"
          version="1.0"
          initial="Start">

    <datamodel>
            <data expr="true" id="VarBool"/>
            <data expr="1" id="VarInt"/>
            <data id="currentResponse" expr="&quot;Sorry I do not
understand!&quot;"  />
    </datamodel>

 <state id="Start">
  <onentry>
   <log expr="'Start'" />
  </onentry>
  <transition event="what-is-my-name" target="WhatIsMyName" />
  <transition event="current-weather" target="CurrentWeather" />
 </state>

 <state id="WhatIsMyName">
  <onentry>
   <log expr="'What is my name'" />
   <assign location="currentResponse" expr="&quot;Your name is noted!&quot;" />
  </onentry>
  <transition target="Start" />
 </state>


INFO: transition (event = what-is-my-name, cond = null, from = /Start,
to = /WhatIsMyName)
Feb 28, 2019 9:04:53 PM org.apache.commons.scxml2.SCXMLExecutionContext execute
INFO: null: What is my name
Feb 28, 2019 9:04:53 PM
org.apache.commons.scxml2.env.SimpleErrorReporter
handleErrorMessageWARNING: EXPRESSION_ERROR
(evalLocation('currentResponse'): java.lang.String cannot be cast to
org.w3c.dom.Node): Expression error inside /WhatIsMyNameFeb 28, 2019
9:04:53 PM org.apache.commons.scxml2.env.SimpleSCXMLListener onEntry
INFO: enter /WhatIsMyName

I have tried with both commons scxml version 0.9 as well as 2.0

Regards,

Diptendu Dutta
Reply | Threaded
Open this post in threaded view
|

Re: [SCXML] <assign> tag usage is giving location error

Woonsan Ko-3
Hi Diptendu,

Hmm... I think I stepped off on the wrong foot, and you're right: It
seems failing with 2.0-M1 tag.
When I execute the same thing [1] with the latest master branch
(2.0-SNAPSHOT), it works fine.
So, I assume it was fixed intentionally or it just cannot occur any
more as of SCXML-243.

Regards,

Woonsan

[1] https://github.com/woonsan/commons-scxml-examples/tree/master/hello-world
[2] https://issues.apache.org/jira/browse/SCXML-243

On Fri, Mar 1, 2019 at 5:27 AM Diptendu Dutta <[hidden email]> wrote:

>
> Do simple assignments of the form <assign location="id" expr="value" />
> work in commons scxml?
>
> I have this state machine description:
>
> <scxml xmlns="http://www.w3.org/2005/07/scxml"
>           version="1.0"
>           initial="Start">
>
>     <datamodel>
>             <data expr="true" id="VarBool"/>
>             <data expr="1" id="VarInt"/>
>             <data id="currentResponse" expr="&quot;Sorry I do not
> understand!&quot;"  />
>     </datamodel>
>
>  <state id="Start">
>   <onentry>
>    <log expr="'Start'" />
>   </onentry>
>   <transition event="what-is-my-name" target="WhatIsMyName" />
>   <transition event="current-weather" target="CurrentWeather" />
>  </state>
>
>  <state id="WhatIsMyName">
>   <onentry>
>    <log expr="'What is my name'" />
>    <assign location="currentResponse" expr="&quot;Your name is noted!&quot;" />
>   </onentry>
>   <transition target="Start" />
>  </state>
>
>
> INFO: transition (event = what-is-my-name, cond = null, from = /Start,
> to = /WhatIsMyName)
> Feb 28, 2019 9:04:53 PM org.apache.commons.scxml2.SCXMLExecutionContext execute
> INFO: null: What is my name
> Feb 28, 2019 9:04:53 PM
> org.apache.commons.scxml2.env.SimpleErrorReporter
> handleErrorMessageWARNING: EXPRESSION_ERROR
> (evalLocation('currentResponse'): java.lang.String cannot be cast to
> org.w3c.dom.Node): Expression error inside /WhatIsMyNameFeb 28, 2019
> 9:04:53 PM org.apache.commons.scxml2.env.SimpleSCXMLListener onEntry
> INFO: enter /WhatIsMyName
>
> I have tried with both commons scxml version 0.9 as well as 2.0
>
> Regards,
>
> Diptendu Dutta

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]