开发者

delete XML node, keep original

开发者 https://www.devze.com 2023-01-01 09:41 出处:网络
I need to delete some nodes from an XML variable and I want to keep the original intact. So I pass the XML to a new variable and delete the nodes from that one but the original changes with it.

I need to delete some nodes from an XML variable and I want to keep the original intact.

So I pass the XML to a new variable and delete the nodes from that one but the original changes with it.

Is there a way to protect the XML from the original va开发者_Go百科riable?


you want to clone the xml, not just set another variable reference to it.

try var xmlbackup:XML = xml.copy();


I think that next code do the job too:

var newXML : XML = new XML(oldXML);
0

精彩评论

暂无评论...
验证码 换一张
取 消