RSS数据输出格式化字符

    protected string FormatXml(string source)
    
{
        StringBuilder sb 
= new StringBuilder();
        XmlTextWriter writer 
= null;
        
try
        
{
            XmlDocument doc 
= new XmlDocument();
            doc.LoadXml(source);

            writer 
= new XmlTextWriter(new StringWriter(sb));
            writer.Formatting 
= Formatting.Indented;

            doc.WriteTo(writer);
        }

        
finally
        
{
            
if (writer != null) writer.Close();
        }

        
return sb.ToString();
    }
原文地址:https://www.cnblogs.com/cnaspnet/p/1236282.html