有没有在.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();