CSharp examples for System.Xml:XML Format
Generate Indented Outer Xml
using System.Xml.Serialization; using System.IO;/*from ww w . j av a 2 s . c o m*/ using System.Xml; using System.Text.RegularExpressions; using System; public class Main{ public static string GenerateIndentedOuterXml(string xmlContent) { StringWriter buffer = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(buffer); writer.Formatting = Formatting.Indented; writer.WriteNode(new XmlTextReader(new StringReader(xmlContent)), false); return buffer.ToString(); } }