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