I load an XmlDocument and then select some nodes into an XmlNodeList instance. If I edit any of those nodes, the XmlDocument will be modified
XmlDocument xd = loadXml();
XmlNodeList xnl = xd.SelectNodes("/root/nodes");
foreach (XmlNode n in xnl)
{
n.InnerText = "";
}
So I understand that modifying the XmlNodeList – modifies the XmlDocument that the node list was taken from.
Is there some way to create a deep copy (I think that’s what I need) of the list of nodes into another XmlElement, so that when I modify these nodes they will be independent of the original location where they were copied from?
There is more than one way to skin an xml cat. This is just one.