设为首页 加入收藏

TOP

AJAX向Response留中输出Xml的办法
2014-11-19 02:34:59 】 浏览:2996
Tags:AJAX Response 输出 Xml 办法

  public static void outPrint(Document doc, HttpServletResponse response) throws IOException {


  response.setCharacterEncoding("UTF-8");


  response.setContentType("text/xml; charset=utf-8");


  PrintWriter out = response.getWriter();


  OutputFormat format = OutputFormat.createCompactFormat();


  //去掉xml头


  //format.setSuppressDeclaration(true);


  //format.isPadText();


  format.setEncoding("utf-8");


  XMLWriter writer = new XMLWriter(out, format);


  writer.write(doc);


  writer.flush();


  writer.close();


  }


  编辑特别推荐:


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇java程序调用命令行 下一篇JSP网站登录记忆跳转实现的一种方..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目