Handy function for properly formatting the whitespace of an XML stream as a string … took me a while to figure this out as most examples show how to format it to a file.
private static string FormatXML(string xml)
{
var doc = new XmlDocument();
doc.LoadXml(xml);
var textWriter = new StringWriter();
var xmlTextWriter = new XmlTextWriter(textWriter) { Formatting = Formatting.Indented };
doc.Save(xmlTextWriter);
return textWriter.ToString();
}
1cbee6cd-4c1a-466d-8fa5-ce182d5054e2|0|.0