Hi Everyone,
I am having a problem when trying to replace a node within an xmlDocument, The strange thing is this works fine with certain XML documents (the xml is actually XAML and quite complex)
Although the Parents node is replaced and using the immediate window and looking at the Parent node the xml looks correct, the underlying XML document does not reflect these changes?
I am at a loss at why this is as with a simple XML document it works fine!
if (control != null)
{
//If the container is one of our custom controls then dont serialize
//This allows us to have our own controls nested within eachother
if (currentNode.ParentNode.ParentNode == null || currentNode.ParentNode.ParentNode.Prefix != "clpm")
{
returnXaml = control.Serialise(currentNode);
xmlReader = new XmlTextReader(new StringReader(returnXaml));
XmlNode replacementNode = xamlTree.ReadNode(xmlReader);
XmlNode parent = currentNode.ParentNode;
parent.ReplaceChild(replacementNode, currentNode);
}
}
}
}
return xamlTree.InnerXml;