C# ? 格式化XML方法

绝地灬酷狼 2023-09-24 12:22 108阅读 0赞

  ///

  /// 鯉塀晒XML圭隈

  ///

  public class UXMLFormat

  {

  public static string FormatXML(string XMLstring)

  {

  //丕刮頁倦頁XML烏猟

  if (!XMLstring.Contains(“

  XmlDocument xmlDocument=GetXmlDocument(XMLstring);

  return ConvertXmlDocumentTostring(xmlDocument);

  }

  public static string ConvertXmlDocumentTostring(XmlDocument xmlDocument)

  {

  MemoryStream memoryStream=new MemoryStream();

  XmlTextWriter writer=new XmlTextWriter(memoryStream, null)

  {

  Formatting=Formatting.Indented//抹序

  };

  xmlDocument.Save(writer);

  StreamReader streamReader=new StreamReader(memor

发表评论

表情:
评论列表 (有 0 条评论,108人围观)

还没有评论,来说两句吧...

相关阅读

    相关 C语言格式化xml

      这是一本以面试题为入口讲解 Java 核心内容的技术书籍,书中内容极力的向你证实代码是对数学逻辑的具体实现。当你仔细阅读书籍时,会发现Java中有大量的数学知识,包括:扰动

    相关 VS Code 格式化 XML 文件的方法

      1、前言   团队协作是稍具规模公司必不可少的问题,也是项目开发进度保证的重要基石。只有团队协作,各自的功力发挥到极致,才能保证团队生产力最大化。随着团队增加,统一的代码