C# 将XmlDocument转化为string
2015-01-05 08:27
375 查看
/// <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; }
相关文章推荐
- 如何将XMLDocument转化成String
- C# 将XmlDocument转化为string函数
- jdom处理的XML Document 和String 之间的相互转化
- jdom处理的XML Document 和String 之间的相互转化
- jdom处理的XML Document 和String 之间的相互转化
- C# 将XmlDocument转化为string函数
- jdom - XML 、Document 、String 之间的相互转化
- [C#] XmlDocument 搭配 Linq 與 XPath
- C#将XML+XSL文件转化为HTML文件的类
- string 转化为XML
- JAVA操作XML二(转换关系):String --document--xml --document--String
- C#操作Xml的两种方式 XPath XmlDocument XmlNodeList
- 如何将xml的String字符串转化标准格式的String字符串
- C#将XML+XSL文件转化为HTML文件的类
- C#中用XmlDocument对象获取带名命空间XML文件的节点值
- C# 关于 xmlreader xmldocument 和xpath 之间的性能比较
- C#操作Xml的两种方式 XPath XmlDocument XmlNodeList
- C#学习笔记之三(delegate, event, Make XML document )
- c# 数组间转化 int[] string[] object[]
- c#将xml字符串转化为dataset