flexÖÐxmlת»¯ÎªarrayʵÀý
±¾ÎĹ²Á½¸öÎļþ£ºtranslate.mxml ºÍ mapmarking.xml
1¡¢translate.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768">
<fx:Script>
<![CDATA[
//xml translate array
public function xmlToArr(xmlObj:XML):Array{
var toArr:Array = new Array();
for(var i:uint = 0; i < xmlObj.site.length(); i++){
toArr.push({pid: xmlObj.site[i].id,
province: xmlObj.site[i].province,
city: xmlObj.site[i].city,
updName: xmlObj.site[i].station,
latitude: xmlObj.site[i].ypos[0],
longitude: xmlObj.site[i].xpos,
telephone: "110"
});
}
return toArr;
}
//parse the array
private function arrParse():void{
var arr:Array = xmlToArr(xmlID);
for(var i:int = 0; i < arr.length; i++){
trace(arr[i].updName + "========" + arr[i].longitude);
}
}
]]>
</fx:Script>
<mx:Button id="butID" horizontalCenter="0" fontSize="18"
label="xml translate array" click="arrParse();"/>
<fx:Declaration
Ïà¹ØÎĵµ£º
Ëæ×Å Adobe Flex ¼¼ÊõµÄ³ÉÊ죬ԽÀ´Ô½¶àµÄÆóÒµ¿ªÊ¼²ÉÓà Adobe Flex ¼¼Êõ¿ª·¢ RIA (Rich Internet Application)¡£ÔÚ³£¼ûµÄ RIA Ó¦ÓóÌÐò¼Ü¹¹ÖУ¬¿Í»§¶ËÓà Adobe Flex äÖȾ³öƯÁÁµÄ½çÃæ£¬¶øäÖȾ½çÃæËùÐèÒªµÄÊý¾ÝÔò´Ó·þÎñÆ÷¶ËµÄÓ¦ÓóÌÐò»ñÈ¡¡£ÔÚ Java EE ÁìÓò£¬·þÎñÆ÷¶ËµÄÓ¦ÓóÌÐòͨ³£ÊÇÔ ......
ÔÚÏîÄ¿ÖУ¬ÎÒÃǺܶ඼Óõ½ÁËxmlÎļþ£¬ÎÞÂÛÊDzÎÊýÅäÖû¹ÊÇÓëÆäËüϵͳµÄÊý¾Ý½»»¥¡£
½ñÌì¾ÍÀ´½²Ò»ÏÂJava ÖÐʹÓÃdom4jÀ´²Ù×÷XMLÎļþ¡£
ÎÒÃÇÐèÒªÒýÈëµÄ°ü£º
//Îļþ°ü
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
//¹¤¾ß°ü
import java.util.Ite ......
×¢£ºµÚÒ»ÁÐÊÇ´øCheckboxµÄTree¡£
»¹ÓÐÎÊÌâÇë½Ì¸÷λ£º
labelFieldÊÇÔªËØ¶ÔÏóµÄÊôÐÔÊÇÏÔʾ²»ÁË£¨carInfo.car_name£©£¬ºÃÏñÖ»¿ÉÏÔʾͬ¼¶µÄÊôÐÔÔõô½â¾ö£¿Ï£Íû¸÷λÄܰïÖúÎÒ£¬Thanks!
<mx:AdvancedDataGrid id="adg" width="100%" height="100%" dataProvider="{instance.cars}"
&n ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script><!--[CDATA[import mx.collections.ArrayCollection;
public var a1:ArrayCollection = new ArrayCollection ([{ Region:"Region1",Territory:"Territory1",Ter ......
ÓùýFLEXÖÐStringÀàÐ͵ÄÅóÓÑ¿ÉÄÜÖªµÀ£¬replaceÕâ¸ö·½·¨²¢²»¹ýÌæ»»ËùÓÐÄÚÈÝ¡£ÄÇôÎÒÃÇÐèÒªÌæ»»ËùÓÐÄÚÈÝÔõô°ì£¿Ö»ÓÐ×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ¿©£¬ºÇºÇ¡£ÑÔ¹éÕýר£¬ÓÐÁ½ÖÖ·½·¨£¬Ò»ÖÖÊÇÀûÓÃArrayµÄ·½Ê½£¬ÁíÒ»ÖÖÊÇÀûÓÃÕýÔòÈ¥Ìæ»»¡£
/**
* StringReplaceAll
* @param source:String Ô´Êý¾Ý
* @param find:String Ìæ»»¶ÔÏó ......