我在使用以下 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">
<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"
似乎 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"