flex xmlºÍarraycollectionÏ໥ת»»
1¡¢arraycollectionת»¯Îªxml£¬´úÂëÈçÏ£º
//¶¯Ì¬Éú³ÉÊ÷Ðνṹ
public static function flatArrayToXML(arr:Object,rootname:String=null,nodename:String=null, outputString:Boolean=false):Object{
if (arr is Array){
}else if ( arr is ArrayCollection){
arr= ArrayCollection(arr).source;
}else if (arr == null){
return null;
}
if (rootname==null) rootname="root";
var xmlstr:String="<"+rootname+" "+"label='ÌײÍÏîÄ¿'>";
var xmlList:XMLList=new XMLList();
var alength:int=arr.length;
if (alength > 0)
{
for (var i:int=0; i < alength; i++)
{
xmlstr+=objToSimpXML(arr[i].name,0,nodename,true);
}
xmlstr +="</"+nodename+">";
}
}
}
xmlstr+="</"+rootname+">";
trace(xmlstr);
var xmldoc:XMLDocument=new XMLDocument(xmlstr);
if (outputString==true)
return xmldoc==null ? "": xmldoc.toString();
var xml:XML=new XML(xmldoc);
return xml;
}
//½«¶ÔÏóת»»Îª¼òµ¥xml.<node property1='value1' property2='value2'/>ÕâÖÖÐÎʽ
//objת»»Ô´¶ÔÏó,½öÖ§³Ö¼òµ¥¶ÔÏó,Èç¹û¶ÔÏóµÄÊôÐÔÒ²ÊÇÒ»¸ö¶ÔÏóÔò²»½øÈëµÝ¹é,
//nodename¿ÉÒÔ×Ô¶¨Òå½ÚµãÃû³Æ, ĬÈÏÊÇ"node"
//ÊÇ·ñÊä³öΪ×Ö·û´®, ĬÈÏת»»Îªxml, Èç¹ûΪtrueÔò½«xml±äΪ×Ö·û´®
//return ÖµÀàÐ͸ù¾ÝoutputString À´¾ö¶¨, ¿ÉÄÜÊÇXML,¿ÉÄÜÊÇString
public static function objToSimpXML(ri_name:String,nodeorchild:int, nodename:String=null, outputString:Boolean=false):String{
if(ri_name==null) return null;
if (nodename==null)nodename="node";//½ÚµãÃû×Ö
var str:String="<"+nodename;
str+=" label='"+filterXMLString(ri_name)+"'";½ÚµãÖÐÊôÐÔµÄÃû×Ö
nodeorchild == 1?str+="/>":str+=">";
//
Ïà¹ØÎĵµ£º
Ç°ÆÚ×¼±¸£º
µã»÷File²Ëµ¥ -> New -> MXML Component£¬È»ºóµ¯³öÒ»¸ö¶Ô»°¿ò¡£
ÔÚ¶Ô»°¿òÖÐÊäÈë×é¼þÃû£¬Ñ¡Ôñ´Ë×é¼þ¼Ì³ÐµÄÀàÐÍ£¬È磺Canvas£¬DataGrid£¬ComboBox …… µÈ¡£
È»ºóÑ¡Ôñ×é¼þµÄ´óС£¬µã»÷Finish¼´¿É¡£
¹ØÓÚ×é¼þ¼Ì³ÐµÄÀàÐÍ£¬¼ÙÉèBased on  ......
gloox×Ô¼ºÊµÏÖÁËxmlµÄ½âÎöÄ£¿é£¬Ã»ÓÐÓõ½µÚÈý·½µÄ¿â(tinyXML£¬expat )
Ö÷ÒªÉæ¼°µÄÎļþ:
tag.h (tag.cpp)
taghandler.h
parser.h (parser.cpp)
1. TagÒ»¸öTag¾ÍÊÇÒ»¸öXMLÔªËØ
ÀýÈç:
a.
<book kind='computer'>
<store id='23'/>
<author>
qiang
</author>
</bo ......
XML£¨Extensible Markup Language£©¼´¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¬ËüÓëHTMLÒ»Ñù£¬¶¼ÊÇSGML(Standard Generalized Markup Language,±ê׼ͨÓñê¼ÇÓïÑÔ)¡£XmlÊÇInternet»·¾³Öпçƽ̨µÄ£¬ÒÀÀµÓÚÄÚÈݵļ¼Êõ£¬Êǵ±Ç°´¦Àí½á¹¹»¯ÎĵµÐÅÏ¢µÄÓÐÁ¦¹¤¾ß¡£À©Õ¹±ê¼ÇÓïÑÔXMLÊÇÒ»ÖÖ¼òµ¥µÄÊý¾Ý´æ´¢ÓïÑÔ£¬Ê¹ÓÃһϵÁмòµ¥µÄ±ê¼ÇÃèÊöÊý¾Ý£¬¶øÕâЩ±ê¼Ç¿ÉÒÔÓà ......
XMLÊDZ»Éè¼ÆΪ´æ´¢¡¢´«ÊäÒÔ¼°½»»»Êý¾ÝµÄ¡£XML²»ÊDZ»Éè¼ÆΪÓÃÀ´ÏÔʾÊý¾ÝµÄ¡£
¡¡¡¡XML¿ÉÒÔ½«HTMLÓëÊý¾Ý·ÖÀë
¡¡¡¡Í¨¹ýʹÓÃXML£¬ÄúµÄÊý¾Ý¿É´æ´¢ÓÚHTMLÖ®Íâ¡£
¡¡¡¡µ±ÎÒÃÇʹÓÃHTMLÀ´ÏÔʾÊý¾Ýʱ£¬Êý¾Ý´æ´¢ÓÚHTMLÖС£Í¨¹ýʹÓÃXML£¬Êý¾Ý¿ÉÒÔ±»´æ´¢ÔÚµ¥¶ÀµÄXMLÎļþÖС£ÕâÑù×öµÄ»°£¬Äú¾Í¿ÉÒÔ°Ñ×¢ÒâÁ¦¼¯ÖÐÔÚʹÓÃHTML½øÐÐÊý¾Ý²¼¾Öº ......