将http响应转换为Java中的XML Document [英] Convert http response to XML Document in Java

查看:138
本文介绍了将http响应转换为Java中的XML Document的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问,有没有办法将我通过互联网的响应转换为xml DOM文档?我知道响应文本是xml格式(服务器发送xml格式的响应)。
我没有使用Java中的http通信,所以我不知道该怎么做。谷歌搜索了一段时间后,我找到了几个例子,但没有运气。

Please, is there any way to convert response i get over the internet to the xml DOM Document? I know that response text is in xml format (server is sending xml-formatted responses). I haven't worked with http communication in Java so i have no idea how to do it. After Googling for a while i found several examples but without luck.

如果我使用方法描述这里我的文档等于null:\

If i use method describes here my Document equals to null :\

请帮忙吗?

推荐答案

我找到了办法:

Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(link);

:)))

这篇关于将http响应转换为Java中的XML Document的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆