我有这个 xml 文件,我想从中获取值:
<test>
<item>
<question audio='audio/AB2001Q.mp3' category='Alertness'>Before you make a U-turn in the road, you should</question>
<description audio='audio/s1,1.mp3'>If you want to make a U-turn, slow down and ensure that the road is clear in both directions. Make sure that the road is wide enough to carry out the manoeuvre safely.</description>
<image ></image>
<answers>
<answer title='a' audio='audio/AB2001A.mp3'>give an arm signal as well as using your indicators</answer>
<answer title='b' audio='audio/AB2001B.mp3'>signal so that other drivers can slow down for you</answer>
<answer title='c' audio='audio/AB2001C.mp3'>look over your shoulder for a final check</answer>
<answer title='d' audio='audio/AB2001D.mp3'>select a higher gear than normal</answer>
</answers>
<correctAnswers>
<answer>c</answer>
</correctAnswers>
</item>
</test>
如何获取问题音频的文本内容和问题文本,例如
“audio/AB2001Q.mp3”是问题音频
“在你掉头之前,你应该”是问题文本
这是我到目前为止所拥有的:
var doc = Ti.XML.parseString(blob);
var branch = doc.getElementsByTagName('item').item(0);
我对 xml 很陌生!