解释的例子之一:


var a_xml = new XML();
a_xml.load("flash.xml");
a_xml.ignoreWhite = true;
a_xml.onLoad = function(s) {
 parse();
};
function parse() {
 //trace(a_xml.firstChild);
 var b_xml = a_xml.firstChild;
 for (i in b_xml) {
  //trace(b_xml[i]);
 }
 for (var i = 0; i<b_xml.childNodes.length; i++) {
  //trace(b_xml.childNodes[i].nodeName);
  //trace(b_xml.childNodes[i].firstChild.nodeValue);
  this[b_xml.childNodes[i].nodeName] = b_xml.childNodes[i].firstChild.nodeValue;
 }
}

例子xml文件:

引用

<?xml version="1.0" encoding="GB2312" ?>
<setting>
 <swf>2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17</swf>
 <jpg>1,30</jpg>
 <cover_half>1</cover_half>
 <back_half>1</back_half>
 <contents>0</contents>
 <record_id>0</record_id>
 <enable_btn>0</enable_btn>
 <load_lr>1</load_lr>
 <load_bg>0</load_bg>
 <showloading>1</showloading>
 <sound_first>1</sound_first>
 <load_cover>1</load_cover>
 <load_corner>1</load_corner>
 <file1>00.jpg</file1>
</setting>




原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
发表评论
表情
emotemotemotemotemotemotemotemotemotemotemotemotemot
emotemotemotemotemotemotemotemotemotemotemotemot
打开HTML 打开UBB 打开表情 隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写
 

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐