首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用NSXMLParser解析scxml文件

如何使用NSXMLParser解析scxml文件
EN

Stack Overflow用户
提问于 2012-10-03 15:15:58
回答 1查看 123关注 0票数 0

我有以下scxml文件

代码语言:javascript
复制
<?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解析这个文件。我的想法是,当我点击按钮时,我们想要检查状态和目标。

我想要显示当前的状态值。

我该怎么做呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-03 19:37:22

整个文档将采用字典格式。在这个字典中,状态将是一个带有键id的字典,转换是另一个带有键,cond的字典。在-didStartElement__中,您可以获得这些值。

我猜,这对你很有效!!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12703588

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档