Sadaf Mansuri’s Blog

August 17, 2010

XMLDocument to string

Filed under: Uncategorized — admin @ 11:56 am
I need to save modified xml in xmlDocument to string variable. Surprisingly, there is no easy way to do it. This is what I found and working
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Xml.XmlTextWriter tr = new System.Xml.XmlTextWriter(sw);
string xmlstring = sw.ToString();

xDoc is my xml document.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress