我想閱讀使用ActionScript 2.0ActionScript 2.0中讀取XML文件
一個XML文件中的問題是,我只能讓我的代碼通過引用它們的位置讀取標籤的價值。
例如 var currentIcon = myXML.firstChild.firstChild.childNodes[0].firstChild;
如何從XMl文件引用標籤名稱檢索值?
例如 var currentIcon = myXML.firstChild.firstChild.childNodes['icon'].firstChild;
這是我的XML文件...
<weather>
<current>
<icon>Partly cloudy</icon>
<temphigh>33</temphigh>
<templow>24</templow>
<humhigh>55</humhigh>
<humlow>95</humlow>
</current>
<forecast1>
<day>Monday</day>
<icon>rss_ts2</icon>
<temphigh>33</temphigh>
<templow>24</templow>
</forecast1>
<forecast2>
<day>Tuesday</day>
<icon>rss_ts2</icon>
<temphigh>32</temphigh>
<templow>23</templow>
</forecast2>
<forecast3>
<day>Wednesday</day>
<icon>rss_ts2</icon>
<temphigh>32</temphigh>
<templow>23</templow>
</forecast3>
</weather>
也有幾個AS2 XML->的OBJ解析器上http://proto.layer51.com/ – ocodo 2011-02-14 04:09:42