XmlDocument xdoc = new XmlDocument();
xdoc.Load( MapPath( "XmlSample.xml" ) );
XmlNode node =
xdoc.SelectSingleNode( "//element[@id=100]" );
// The following line will lead to
// an InvalidOperationException
node.Value = "New value!!";
xdoc.Save( MapPath( "XmlSample.xml" ) );
Instead, use the InnerText property:
node.InnerText = "New value!!";
[Edited: 4 Aug 2008]
7 comments:
Thank you for documenting this issue and its fix!
Thanks for your comment, Mike.
Thanks for the post. That helped me quickly fix the issue.
Thanks it helps me too
Thanks it helps me too.
Thanks it helped me
Post a Comment