commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingmar Kliche <>
Subject Re: [SCXML] Polling in datamodel
Date Tue, 05 May 2009 13:50:47 GMT
you should be able to use the DOM API to read the values. In
context.set(name, value) you should check whether the value is a DOM node:

import import org.w3c.dom.Node;

... set(String name, Object value) {

        if (value instanceof Node) {
            Node nodeValue = (Node) value;

scope.put(name, scope, value);

2009/5/5 Linda Erlenhov <>

> Hello.
> I´m back with another thousand questions!
> Still with my datamodel like this:
> ------------------------------------
> <scxml version="1.0" initialstate="176" xmlns:cs="
>" xmlns="">
> <datamodel>
> <data name="DynamicData">
> <Data_1 xmlns="" id="1" type="Integer">0</Data_1>
> <Data_2 xmlns="" id="2" type="Integer">0</Data_2>
> <Data_3 xmlns="" id="3" type="String">none</Data_2>
> </data>
> <data name="DDChange"/>
> <data name="DDValue"/>
> <data name="DDType"/>
> <data name="Indication_1" expr="false"/>
> </datamodel>
> .......................................snip.......
> Later on i set the data:
> ...........................................snip.....
> <state id="StateB">
> <onentry>
> <log label="Renegade" expr="'Entering state: StateB'"/>
> <log label="Renegade" expr="Data(DynamicData,'Data_1')"/>
> <assign location="Data(DynamicData,'Data_1')"
> expr="Data(DynamicData,'Data_1')+1"/>
> <assign name="DDValue" expr="Data(DynamicData,'Data_1')"/>
> <assign name="DDChange" expr="'Data_1'"/>
> <log label="Renegade" expr="Data(DynamicData,'Data_1')"/>
> </onentry>
> ..........snip--------------------
> So now here´s the problem.
> As you see I haven´t used the custom action, but an rather ugly hack where
> I
> do an assign name after I do the assign location to trigger a call to the
> "set" function in the context.
> In this version I also do another assign where I assign another name with
> the value. All my data are named Data_XX so i screen the calls to set byt
> looking for the ones that are named Data_XX. When I recieve a call for
> Data_XX I would like to know what the value is, which I in this case have
> solved by assigning another variable with it earlier, when i get a "set"
> call named Data_xx i know that the variable DDValue contains the value of
> this data. Not pretty, but OK and working so far.
> Now I would like to be able to see what "type" the data is aswell. How do I
> do that? And: Is there a less spaghetti way to poll the value of the data
> from where I am (In the context) when I have the "name" of it. (The name in
> this case is Data_1, Data_2 or Data_3, I also know that the data=name is
> DynamicData) .
> Due to lack of time I would prefer if i wouldn´t have to "redo" to much of
> the scxml, but is this possible to do it my way otherwise? Or do I have to
> do it over.
> Best Regards
> //Linda

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message