Geeks With Blogs

News


Rodney Vinyard - .NET & SQL Developer When all is said and done, more will be said than done

Original Article:

http://bytes.com/forum/thread176986.html

Is there a simple way to indent xml with dotnet? SQL Server returns a long xml string that is hard
> to read.[/color]

XmlReader r = new XmlTextReader(new StringReader(myXML));
StringWriter sw = new StringWriter();
XmlTextWriter w = new XmlTextWriter(sw);
w.Formatting = Formatting.Indented;
while (r.Read())
w.WriteNode(r, false);
w.Close();
r.Close();
Console.WriteLine(sw.ToString());
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Posted on Monday, August 11, 2008 2:09 AM XML & Datasets | Back to top


Comments on this post: indent xml with .NET

# re: indent xml with .NET
Requesting Gravatar...
What a great post, was very interesting and very helpful.
Left by canvas prints on Sep 23, 2011 10:17 AM

Your comment:
 (will show your gravatar)


Copyright © Rodney Vinyard | Powered by: GeeksWithBlogs.net