public static String BeautifyXML(String XML){ String Result = ""; MemoryStream M_S = new MemoryStream(); XmlTextWriter X_T_W = new XmlTextWriter(MS, Encoding.Unicode); XmlDocument DOC = new XmlDocument(); try { DOC.LoadXml(XML); X_T_W.Formatting = Formatting.Indented; DOC.WriteContentTo(W); X_T_W.Flush(); M_S.Flush(); M_S.Position = 0; StreamReader S_R = new StreamReader(M_S); String FormattedXML = S_R.ReadToEnd(); Result = FormattedXML; } catch (XmlException) { } M_S.Close(); X_T_W.Close(); return Result;}