Problem raising event in scxml

1.2k Views Asked by At

I'm having a problem with the following scxml code:

<?xml version="1.0" encoding="utf-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="global">
    ...
    <state id="global" initial="init">
    ...
    <state id="state2">
        <onentry>
            <if cond="mydata.skip">
                <if cond="_event.name=='ev.prev'">
                    <raise event="ev.prev" />
                    <else/>
                    <raise event="ev.next" />
                </if>
            </if>
       </onentry>
       <transition event="ev.next" target="end" />
       <transition event="ev.prev" target="state1" />
    </state>
    ...
    </state>
</scxml>

It works ok but when I have added the onentry element the proccessor says the following:

[WARN] Ignoring element <raise> in namespace "http://www.w3.org/2005/07/scxml" at null:2:882 and digester match "scxml/state/state/onentry/if/if/raise"
[WARN] Ignoring element <raise> in namespace "http://www.w3.org/2005/07/scxml" at null:2:912 and digester match "scxml/state/state/onentry/if/if/else/raise"

It seems that raise is not understood. I've tried to change 'raise' element with the 'send' one and I've gotten a similar log warning. Can anyone tell me what may be wrong?

Thanks.

UPDATE

I've tried to change the schema avoiding the embedding of the if elements like this:

<?xml version="1.0" encoding="utf-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="global">
    ...
    <state id="global" initial="init">
    ...
    <state id="state2">
        <onentry>
            <if cond="mydata.skip and _event.name=='ev.prev'">
                <raise event="ev.prev" />
                <else if cond="mydata.skip and _event.name=='ev.next'"/>
                <raise event="ev.next" />
            </if>
       </onentry>
       <transition event="ev.next" target="end" />
       <transition event="ev.prev" target="state1" />
    </state>
    ...
    </state>
</scxml>

but it gives the following error too:

[WARN] Ignoring element <raise> in namespace "http://www.w3.org/2005/07/scxml" at null:2:1057 and digester match "scxml/state/state/onentry/if/raise"
1

There are 1 best solutions below

0
On

I couldn't make the raise event work either. But according to the standard: http://www.w3.org/TR/scxml/#raise you can also use a send event. So I tried that, and I could make that work.

<state id="testID">
    <onentry>
        <send event="'test.onentry'" />
    </onentry>
    <transition event="test.transition" target="testID2"></transition>
</state>

That sent the event test.onentry as expected. But note the single quotes inside the double quotes in there!