Java scxml中引发事件的问题
我对以下scxml代码有问题:Java scxml中引发事件的问题,java,scxml,apache-commons-scxml,Java,Scxml,Apache Commons Scxml,我对以下scxml代码有问题: <?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">
<?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>
...
...
...
它工作正常,但当我添加了onentry元素时,进程会显示以下内容:
[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"
[WARN]忽略命名空间中的元素”http://www.w3.org/2005/07/scxml“在null:2:882和摘要匹配”scxml/state/state/onentry/if/if/raise”
[警告]忽略命名空间中的元素”http://www.w3.org/2005/07/scxml在null:2:912处,摘要匹配“scxml/state/state/onentry/if/if/else/raise”
这似乎是不理解的。我试图用“send”元素更改“raise”元素,但收到了类似的日志警告。谁能告诉我可能出了什么问题吗
谢谢
更新
我尝试更改模式,以避免像下面这样嵌入if元素:
<?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>
...
...
...
但它也会产生以下错误:
[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"
[WARN]忽略命名空间中的元素”http://www.w3.org/2005/07/scxml“在null:2:1057处,消化池匹配”scxml/state/state/onentry/if/raise”
我也无法使raise事件工作。但根据标准:
您还可以使用发送事件。所以我试过了,我能做到
<state id="testID">
<onentry>
<send event="'test.onentry'" />
</onentry>
<transition event="test.transition" target="testID2"></transition>
</state>
已按预期发送事件test.onetry。但是请注意双引号中的单引号