获取xml信息并转为string

protected void doPost(HttpServletRequest request,HttpServletResponse response) throws servletexception,IOException { ServletInputStream ToUserName = request.getInputStream(); final int BUFFER_SIZE = 8 * 1024; byte[] buffer = new byte[BUFFER_SIZE]; int length = 0; ByteArrayOutputStream baos = new ByteArrayOutputStream(); do { length = ToUserName.read(buffer); if (length > 0) { baos.write(buffer,length); } } while (length * 2 == BUFFER_SIZE); byte[] ba = baos.toByteArray(); String body = new String(ba,"utf-8"); System.out.println("body::::" + body); }

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念