如何使用adobe air获取“节点数”XML

时间:2010-11-10 09:09:59

标签: xml count air

我想问一下如何使用符号'question'获取节点XML的数量......

如果我有一些像这样的xml数据:

 <?xml version='1.0' encoding='utf-8'?>
  <questioner>
     <question>
         <id>001</id>
         <content>soal 1</content>
          <answer>a</answer>
     </question>
     <question>
          <id>002</id>
          <content>soal 2</content>
         <answer>a</answer>
     </question>
    <question>
          <id>003</id>
          <content>soal 3</content>
          <answer>a</answer>
    </question>
    <question>
          <id>004</id>
          <content>soal 4</content>
          <answer>a</answer>
    </question>
</questioners>

1 个答案:

答案 0 :(得分:0)

var xml:XML = ... //init xml
var questionList:XMLList = xml.elements("question");
questionList.length // question count

这不是特定于AIR的,Flash在任何地方都具有XML功能。

相关问题