April 28th, 2007
Flash 的 firstNode childNode 使你頭爆?

一個 xml sample file:
<?xml version="1.0" encoding="utf-8"?>
<classroom>
<student_list>
<student>
<name>Joe Micho</name>
<sid>K15439887</sid>
<gender>M</gender>
</student>
<student>
<name>Sirrine Lam</name>
<sid>K513854</sid>
<gender>F</gender>
</student>
</student_list>
</classroom>
不必再使用那令人發顛的 firstnode/childnode 語法就可以 parse 得到:
trace(classroom.student_list.student[0].name);
OUTPUT:
Joe Micho
下載經我簡化了的 example source:
pxp2.zip
原作者的詳盡 tutorial:
A Better way to parse XML!

