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 ......
http://www.cnblogs.com/beniao/archive/2009/01/12/1373921.html
ÎÞ·¨ÔËÐÐÈçÉϲ©¿ÍµÄ´úÂ룬ÓÚÊÇ×Ô¼ºµ½ÍøÉÏÕÒ×ÊÁÏ
·¢ÏÖÔÚhttp://hi.baidu.com/littlelaa/blog/item/bdea73f2382289a6a50f5241.html
¹Ø¼üÊÇC#ÖÐREADLINEÕâ¸ö·½·¨ÎÞ·¨ÔÚÈýÃëÄÚ¶ÁÈ¡£¬ÒòΪ½áβûÓÐ/N /RµÈ×Ö·û¡£
C#¶Ë
using System;
using System.Net.Socke ......
Flex¶Ë´úÂ룺
<?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/mx" minWidth="955" minHeight="600"
>
<fx:Script>
<!--[C ......
Ñо¿E4XÓëFlexµÄ¹Øϵ£¬ËùÒÔ´òËã×ܽáһϣ¬ÓÐ˵µÄ²»¶ÔµÄµØ·½£¬»¹Çë´ó¼Ò¶à¶àÔÁ¡£
Ò»¡¢×î¼òµ¥Ä£Ê½£ºFlexͨ¹ýhttpserviceºÍdataProvider½øÐÐÊý¾Ý´«Êä
Xml¸ñʽÈçÏ£º
<?xml version="1.0" encoding="utf-8" ?>
<Result>
<NodeA>value1</NodeA>
<NodeB>valve2</NodeB>
…&he ......