public static string FormatXmlString(string xmlString)
         {
             XmlDocument document = new XmlDocument();
             document.LoadXml(xmlString);

            MemoryStream stream = new MemoryStream();
             XmlTextWriter writer = new XmlTextWriter(stream, null);
             writer.Formatting = Formatting.Indented;
             document.Save(writer);

            StreamReader streamReader = new StreamReader(stream, System.Text.Encoding.UTF8);
             stream.Position = 0;

            string returnValue = streamReader.ReadToEnd();

            streamReader.Close();
             stream.Close();

            return returnValue;
         }

 

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-10-04
  • 2021-09-16
  • 2022-03-05
  • 2022-03-08
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2021-10-04
  • 2021-12-05
  • 2021-10-27
  • 2021-05-30
相关资源
相似解决方案