有没有人知道如何在Flex3 ActionScript中合并两个xml文件或两个xmllist对象?
感谢。
答案 0 :(得分:1)
假设您只想追加:
//all items from 2 are now added to 1
for each(var item:xml in myXMLList2){
myXMLList1.appendChild(item);
}
//all items added to new XMLlist
var myMergedXMLList:XMLList;
for each(var item:xml in myXMLList1){
myMergedXMLList.appendChild(item);
}
for each(var item:xml in myXMLList2){
myMergedXMLList.appendChild(item);
}
答案 1 :(得分:0)
我应用了flipSpear建议的部分内容并使其工作。感谢大家的评论/回答。
var xmlstr1:String =“我的值1My值2”
var xmlstr2:String =“我的价值3天价值4”
var xml1:XML; var xml2:XML;
var xmlst1:XMLList; var xmlst2:XMLList; var xmlstMerged:XMLList = new XMLList(); var item:XML
xml1 = XML(xmlstr1); xml2 = XML(xmlstr2);
xmlst1 = new XMLList(xml1); xmlst2 = xml2.document;
表示每个(xmlst2中的项目){ xmlst1.appendChild(项目); }
xmlstMerged = xml1.document;