[AS3]as3下XML操作:添加与查找
AS3]as3下XML操作:添加与查找
AS3]as3下XML操作:添加与查找
- package
- {
- import flash.display.Sprite;
- public class Main extends Sprite
- {
- public function Main():void
- {
- init();
- }
- private function init():void
- {
- var foo:String =
- "<websites>" +
- "<site name='Kingda blog' url='http://www.kingda.org'>" +
- "<pageview>100000</pageview>" +
- "</site>" +
- "<site name='ActionScript3' url='http://www.actionscript3.cn'>" +
- "<pageview>4500</pageview>" +
- "</site>" +
- "</websites>";
- var kingdaXML:XML = new XML(foo);
- kingdaXML.site[0].author = new XML();
- //CuPlayer.com提示添加空白新节点
- kingdaXML.site[0].author = "新节点值";
- //CuPlayer.com提示添加一个属性
- kingdaXML.site[0].author.@uu = "属性值";
- //再天津爱一个location节点并赋值
- kingdaXML.site[0].location = "AAAAAAAAAAA";
- //将新添加的location节点删掉
- delete kingdaXML.site[0].location;
- trace(kingdaXML);
- //查找值小于50000的pageview子元素
- trace(kingdaXML.site.(pageview < 50000));
- //查找值等于Kingda blog的属性name子元素
- trace(kingdaXML.site.(@name == "Kingda blog"));
- //CuPlayer.com
- }
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...