XML TO ArrayCollection 两种实现方式
<?xml version="1.0" encoding="UTF-8"?>
<projects>
<node Country="暗暗啊" Gold="10" Silver="20" Bronze="30"/>
<node Country="白斑病" Gold="30" Silver="20" Bronze="10"/>
<node Country="常常厂" Gold="20" Silver="40" Bronze="60"/>
<node Country="赌东道" Gold="50" Silver="30" Bronze="10"/>
<node Country="饿饿额" Gold="15" Silver="18" Bronze="46"/>
<node Country="方法法" Gold="61" Silver="52" Bronze="38"/>
</projects>
<mx:HTTPService id="HTTPService1"
url="charts_ColumnChart.xml"
result="initFile(event)" showBusyCursor="true" method="post"
resultFormat="e4x"/>
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
private var ac:ArrayCollection = new ArrayCollection();
function initFile(event:ResultEvent):void{
for each(var p:XML in event.result..node){
var obj:Object=new Object();
obj.Country=p.@Country;
obj.Gold=p.@Gold;
obj.Silver=p.@Silver;
obj.Bronze=p.@Bronze;
ac.addItem(obj);
}
}
二:
复制代码 代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<projects>
<node>
<Country>暗暗a</Country>
<Gold>10</Gold>
<Silver>20</Silver>
<Bronze>30</Bronze>
</node>
<node>
<Country>暗b啊</Country>
<Gold>10</Gold>
<Silver>20</Silver>
<Bronze>30</Bronze>
</node>
<node>
<Country>暗c啊</Country>
<Gold>10</Gold>
<Silver>20</Silver>
<Bronze>30</Bronze>
</node>
</projects>
<mx:HTTPService id="HTTPService2"
url="charts_ColumnChart1.xml"
result="initFile1(event)" showBusyCursor="true" method="post"
resultFormat="e4x"/>
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
private var ac1:ArrayCollection = new ArrayCollection();
function initFile1(event:ResultEvent):void{
for each(var p:X
相关文档:
xml文件:
<?xml version="1.0" encoding="iso-8859-1"?>
<Products>
<product>
<name>lovechoosesun</name>
<buyNowURL>http://merch.danecook ......
If XML data in the table is less than 32K for each record, then you can directly unload the data as char. If XML data exceeds 32K for some records, then you have to unload the common data and the XML data separately. First, create a template for unloading XML into a PDS: TEMPLATE LOBFRV DSN 'AAA. ......
转:http://hi.baidu.com/oneshotonekill/blog/item/be68b513f7c929d7f6039e1e.html
Whitespace is not allowed before an XML Processing Instruction (< ? ... ?>). HTMLComponent.Eclipse在编辑mxml的时候提示这样的错误。检查才发现代码中在<? ?>之前存在空格。 ......