public static string FormatRawXml(string xmlText) { try { XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlText); StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.Formatting = Formatting.Indented; xmlWriter.Indentation = 4; xmlWriter.IndentChar = ' '; doc.WriteContentTo(xmlWriter); return stringWriter.ToString(); } catch (Exception ex) { LibSystem.Diagnostics.ExceptionHandler.Show(ex); return ""; } }