Clearing Only inner text and not the childnodes
Posted
by Ravisha
on Stack Overflow
See other posts from Stack Overflow
or by Ravisha
Published on 2010-03-26T13:47:47Z
Indexed on
2010/03/26
13:53 UTC
Read the original article
Hit count: 130
I have an xml as below
< Image>ImageValue11
<Type>png<Type>
<Value>ImageValue11</ 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 usign 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.
© Stack Overflow or respective owner