public static class XmlDocumentPrettyExtension
{
public static string Prettyify(this XmlDocument xmlDocument)
{
var stringWriter = new StringWriter(new StringBuilder());
var xmlTextWriter = new XmlTextWriter(stringWriter) { Formatting = Formatting.Indented };
xmlDocument.Save(xmlTextWriter);
return stringWriter.ToString();
}
}
Comments