首页 > 其他 > 详细

XMLDocument转为String 摘录

时间:2015-11-11 09:55:06      阅读:192      评论:0      收藏:0      [点我收藏+]

reference:

http://blog.csdn.net/cai15191466621/article/details/6977686

 

public static string FormatXmlString(string xmlString)
         {
             XmlDocument document = new XmlDocument();
             document.LoadXml(xmlString);

            MemoryStream stream = new MemoryStream();
             XmlTextWriter writer = new XmlTextWriter(stream, null);
             writer.Formatting = Formatting.Indented;
             document.Save(writer);

            StreamReader streamReader = new StreamReader(stream, System.Text.Encoding.UTF8);
             stream.Position = 0;

            string returnValue = streamReader.ReadToEnd();

            streamReader.Close();
             stream.Close();

            return returnValue;
         }

 

XMLDocument转为String 摘录

原文:http://www.cnblogs.com/shy1766IT/p/4955149.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!