.NET XML pretty的打印机?打印机、NET、XML、pretty

2023-09-03 03:18:36 作者:思緒讓人糾結

有没有在.NET Framework的方法或一个免费的开源库pretty的打印XML?

Is there a method in the .NET Framework or a free Open Source library to pretty print XML?

推荐答案

所有的.NET的标准XML的API将格式化的输出。

All of .Net's standard XML APIs will format their output.

使用LINQ to XML:

Using LINQ to XML:

string formatted = XDocument.Parse(source).ToString();

string formatted = XDocument.Load(path).ToString();