I have an xml as below
< Image>ImageValue1
<Type>png</Type>
<Value>ImageValue1</ Value>
</ Image>
Here ImageValue1 is present in two places.I want to remove innerText for Image node which is the parent.For which I am using the below code
XmlNode customImageNode = imagedoc.SelectSingleNode("//Image");
customImageNode.InnerText = string.empty;
But this is clearing the child nodes as well.Please let me know how to clear this test off .Looking for a generic solution.
I believe what you need to do is select just the text node of the
Imagenode. You do this like this:I just tested the above code and it worked for me. Good luck!