删除XML节点,保留原来的
我需要从 XML 变量中删除一些节点,并且希望保持原始节点不变。
因此,我将 XML 传递给一个新变量,并从该变量中删除节点,但原始变量随之发生变化。
有没有办法保护 XML 免受原始变量的影响?
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 variable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要克隆 xml,而不仅仅是设置另一个变量引用它。
尝试 var xmlbackup:XML = xml.copy();
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: