1[C#]格式化XmlDocumentstring s = “<Test><a></a></Test>”;
 2[C#]格式化XmlDocumentSystem.Xml.XmlDocument doc = new System.Xml.XmlDocument();
 3[C#]格式化XmlDocumentdoc.LoadXml(s);
 4[C#]格式化XmlDocumentSystem.IO.MemoryStream ms = new System.IO.MemoryStream();
 5[C#]格式化XmlDocumentSystem.Xml.XmlTextWriter xmlWriter = new System.Xml.XmlTextWriter(ms, Encoding.UTF8);
 6[C#]格式化XmlDocumentxmlWriter.Indentation = 4;
 7[C#]格式化XmlDocumentxmlWriter.Formatting = System.Xml.Formatting.Indented;
 8[C#]格式化XmlDocumentdoc.WriteContentTo(xmlWriter);
 9[C#]格式化XmlDocumentxmlWriter.Close();
10[C#]格式化XmlDocumentstring result = Encoding.UTF8.GetString(ms.ToArray());

相关文章:

  • 2022-01-25
  • 2021-10-22
  • 2021-06-26
  • 2022-02-01
  • 2022-02-12
  • 2022-01-13
  • 2021-09-17
猜你喜欢
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-04-05
相关资源
相似解决方案