在XMLList里插入节点
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
顶~~~~~~~