/// <summary> /// 将XmlDocument转化为string /// </summary> /// <param name="xmlDoc"></param> /// <returns></returns> public string ConvertXmlToString(XmlDocument xmlDoc) { MemoryStream stream = new MemoryStream(); XmlTextWriter writer = new XmlTextWriter(stream, null); writer.Formatting = Formatting.Indented; xmlDoc.Save(writer); StreamReader sr = new StreamReader(stream, System.Text.Encoding.UTF8); stream.Position = 0; string xmlString = sr.ReadToEnd(); sr.Close(); stream.Close(); return xmlString; }
本文URL地址:http://www.bianceng.cn/Programming/csharp/201410/45485.htm
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索string
, stream
, xmldocument
, streamreader
, MemoryStream
XmlTextWriter
c站、c语言、cf、ch、c罗,以便于您获取更多的相关知识。
时间: 2024-12-28 02:32:37