C#: Indent XML String

MemoryStream w = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(w, Encoding.Unicode);

XmlDocument document = new XmlDocument();
writer.Formatting = Formatting.Indented;

w.Seek(0L, SeekOrigin.Begin);

StreamReader reader = new StreamReader(w);
return reader.ReadToEnd();


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: