【问题标题】:XmlDocument OuterXml pretty printedXmlDocument OuterXml 打印得很漂亮
【发布时间】:2011-01-27 16:16:45
【问题描述】:

我有一个 XmlDocument,我想将内容 (OuterXml) 作为一个漂亮的打印字符串。我该怎么做?

问候

【问题讨论】:

  • 你需要语法高亮还是缩进?

标签: c# xmldocument pretty-print


【解决方案1】:

假设我理解正确

using System.Xml.Linq;
XDocument xDoc = XDocument.Load(@".....\test.xml");
string xDocString = xDoc.ToString(SaveOptions.None);

【讨论】:

  • “或者你可以使用”链接失效
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-12-01
  • 1970-01-01
  • 2021-06-22
  • 2014-08-13
  • 2016-07-07
  • 2014-05-19
  • 1970-01-01
相关资源
最近更新 更多