var xml:XML = new XML( <data>
<user>
<user id="1"/>
<user id="2"/>
</user>
</data> );
var xmlList:XMLList = xml.user.user;
var myXML:XML = new XML(<user id="3"/>);
insertXML(xmlList, myXML);
trace("-------- xmlList -----------");
trace(xmlList);
trace("---------- xml -------------");
trace(xml);
function insertXML(xmlList:XMLList, xml:XML):void
{
// 修改xmlList,建议用这个
xmlList[xmlList.length()] = xml;
// 不修改xmlList
//xmlList.parent().appendChild(xml);
}
» 转载请注明来源:www.litefeel.com » 《在XMLList里插入节点》
» 本文链接地址:https://www.litefeel.com/insert-node-to-xmllist/
» 订阅本站:www.litefeel.com/feed/
» Host on Linode VPS
» 本文链接地址:https://www.litefeel.com/insert-node-to-xmllist/
» 订阅本站:www.litefeel.com/feed/
» Host on Linode VPS
This post was last modified on 2019 年 03 月 04 日 01:31
View Comments (1)
顶~~~~~~~