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 = ; string returnValue = streamReader.ReadToEnd(); streamReader.Close();
stream.Close(); return returnValue;
}

XMLDocument转为String 摘录的更多相关文章

  1. java语言中Object转为String的几种形式

    在java项目的实际开发和应用中,常常需要用到将对象转为String这一基本功能.本文将对常用的转换方法进行一个总结.常用的方法有Object.toString(),(String)要转换的对象,St ...

  2. [C#]List<int>转string[],string[]转为string

    // List<int>转string[] public string[] ListInt2StringArray(List<int> input) { return Arra ...

  3. XmlDocument To String

    一.从String xml到XmlDocument的: string xml = "<XML><Test>Hello World</Test></X ...

  4. inputStream输入流转为String对象(将String对象转为inputStream输入流)

    不得不说org.apache.commons包下有很多实用的工具类. org.apache.commons.io.IOUtils; 要将inputStream输入流转为String对象,只需使用org ...

  5. netty: 将传递数据格式转为String,并使用分隔符发送多条数据

    自定义分割符,用:DelimiterBasedFrameDecoder类 ByteBuf转String,用StringDecoder类 参考代码: //设置连接符/分隔符,换行显示 ByteBuf b ...

  6. 集合流之“将List<Integer>转为String并用逗号分割”

    1.使用[流+Collectors]转换 import java.util.ArrayList; import java.util.List; import java.util.stream.Coll ...

  7. C++中int转为char 以及int 转为string和string 转int和空格分隔字符串

    1.对于int 转为char 直接上代码: 正确做法: void toChar(int b) { char u; ]; _itoa( b, buffer, ); //正确解法一 u = buffer[ ...

  8. C++中int转为char 以及int 转为string和string 转int和字符串的split

    1.对于int 转为char 直接上代码: 正确做法: void toChar(int b) { char u; ]; _itoa( b, buffer, ); //正确解法一 u = buffer[ ...

  9. Object类型的转为String类型

    Map<String, Object> scaleMap = new HashMap(): scaleMap.put("name","张三"); S ...

随机推荐

  1. 创建Windows窗体 : WinMain() 与 WndProc()

    #include <windows.h> #include <mmsystem.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, ...

  2. appium+python自动化52-多点触控MultiAction

    前言 MultiAction是针对多点触控操作的,是TouchAction的一个补充模块 TouchAction用法参考前面的一篇:appium+python自动化33-TouchAction 多点触 ...

  3. mybatis连接mysql数据库插入中文乱码

    对于MySQL数据库的乱码问题,有两种情况: 1. mysql数据库编码问题(建库时设定). 2. 连接mysql数据库的url编码设置问题. 对于第一个问题,目前个人发现只能通过重新建库解决,建库的 ...

  4. Linux系统getopt使用示例

    #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdint.h&g ...

  5. Windows MongoDB安装配置

    1.下载 官网:http://www.runoob.com/mongodb/mongodb-window-install.html 由于是在window下,所以我下载的是mongodb-win32-x ...

  6. java基础知识精华

    转载:https://www.jianshu.com/p/6c078abb720f java基础知识 java内存模型 java运行时数据区域 hashMap 如何解决冲突 存储方式 冲突达到一定数量 ...

  7. Was liberty资料总结

    WebSphere Application Server Liberty Profile Guide for Developers: http://www.redbooks.ibm.com/redbo ...

  8. Java并发性和多线程介绍目录

    http://ifeve.com/java-concurrency-thread-directory/

  9. 从错误中学python(2)————字符串转浮点数

    题目 自己编写函数:利用map和reduce编写一个str2float函数,把字符串'123.456'转换成浮点数123.456: 题目来源--致敬廖雪峰 解决过程 初步的解决方法 def str2f ...

  10. 扩展MSEG 加入Z字段

    append    MSEG append    IMSEG append    BAPI_TE_XMSEG 实现 BADI: MB_BAPI_GOODSMVT_CREATE BAPI中: BAPI_ ...