【问题标题】:How to parse the scxml file using NSXMLParser如何使用 NSXMLParser 解析 scxml 文件
【发布时间】:2012-10-03 07:15:57
【问题描述】:

我有以下 scxml 文件

<?xml version = "1.0"?>
<scxml version="1.0" name="statemachine" initial="initialState" xmlns="http://www.w3.org/2005/07/scxml" binding="early" exmode="lax">

<state id="initialState">
    <transition target="state1" cond="TRUEPREDICATE" />
</state>
<state id="state1">
    <transition target="state2" cond="SELF.currentStateName == 'state1'" />
</state>
<state id="state2">
    <transition target="state1" cond="SELF.currentStateName == 'state2' && SELF.count <  5" />
    <transition target="finalState" cond="SELF.currentStateName == 'state2' && SELF.count >=  5" />
</state>
<state id="finalState"/>
</scxml>

我想使用 NSXMLParser 解析这个文件。当我单击按钮时,我的想法是,我们要检查状态和目标。
我想显示当前状态值。

我该怎么做?

【问题讨论】:

    标签: iphone ios5 ios6 nsxmlparser


    【解决方案1】:

    整个文档将采用 字典 格式。在此字典中,state 将是一个具有键 id 的字典,而 transition 是另一个具有键目标、cond 的字典。在-didStartElement,你可以得到这些值。

    猜猜,这对你有用!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-21
      • 1970-01-01
      • 2011-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-06
      • 2012-12-13
      相关资源
      最近更新 更多