ArrayList转XML

//ArrayList转换为xml
var treedata:String="<ids id='" + rootObject.id + "' labels='" + rootObject.name + "'>\n";
treedata=CreateXmlNode(neList, rootFdn, treedata);
treedata=treedata + "</ids>\n";

XML xml = new XML(treedata);



//ArrayList转换为XML
public function CreateXmlNode(list:ArrayList, parentFdn:String, cratedata:String):String
{
        for (var a:int=0; a < list.length; a++)
        {
                var fsort:Object=list.getItemAt(a) as Object;
                if (fsort.parentFdn == parentFdn)
                {
	        cratedata=cratedata + "<ids id='" + fsort.id +  "' labels='" + fsort.name + "'/>";
                }
        }
        return cratedata;
}

 

你可能感兴趣的:(ArrayList转XML)