flex - 从 xml 列表获取数据
我有一个简单的 xml,如下所示:
<root Name="Bob" isImployed="true">
<customer Name="Bob" id="12345">was addressed in the shopping mall</customer>
<Job-title>Insurance</Job-title>
<experience>15</experience>
<Question1 question="how much do you make?">35000</Question1>
<Question2 question="do you get a yearly bonus?">5000</Question2>
<Question3 question="would you be interested in our weekly plan?">yes</Question3>
</root>
我创建了一个包含数据的 XMLList:
var mylist:XMLList;
我想检查所有问题(不仅仅是问题 1、问题 2 和问题 3)。其中一些包含数字(工资、奖金),有些则不包含。我正在寻找一种方法来遍历整个列表,查询答案是否是数字,如果是,则获取数字。 (并用它做一些计算)。我怎样才能做到这一点?
谢谢!
i have a simple xml like so:
<root Name="Bob" isImployed="true">
<customer Name="Bob" id="12345">was addressed in the shopping mall</customer>
<Job-title>Insurance</Job-title>
<experience>15</experience>
<Question1 question="how much do you make?">35000</Question1>
<Question2 question="do you get a yearly bonus?">5000</Question2>
<Question3 question="would you be interested in our weekly plan?">yes</Question3>
</root>
i've created an XMLList containing the data:
var mylist:XMLList;
I would like to go over all the questions (there are more than question1,question2 and question3). some of those contain numbers (salary, bouns) and some don't. I am looking for a way to go over the whole list, querying if the answer is a number or not, and if so - get the number. (and do some calculation with it). How can I do that?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个循环应该遍历该 xml 并读取所有问题的值并获取数字:
This loop should go thru that xml and read the values of all questions and get the ones that are numbers:
这应该为您提供所需的所有部件。
This should give you all the parts you need.