当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
计算机二级考试指导:AJAX向Response留中输出Xml的方法
发布时间:2010/3/30 18:32:51 来源:城市学习网 编辑:admin

  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();
  }
  :

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved