解析来自 Web 服务的结果

发布于 2024-09-30 06:20:16 字数 306 浏览 0 评论 0原文

我目前正在尝试解析从网络服务返回的结果。有没有一种方法可以以简单的方式做到这一点。响应以 XML 格式返回。目前,代码如下:

Uri uri = Uri.parse("http://www.example.com/restaurant/sanfrancisco?search=pizza");      
Intent intent = new Intent(Intent.ACTION_VIEW, uri);

该代码返回的结果是单个数据块。我想获取这个结果并以合适的格式显示它们,最好是列表格式。 有没有直接的方法来做到这一点?

I am currently trying to parse the results returned from a webservice. Is there a way to do this in a simple manner. The response is returned in XML format. Currently, the code is as follows:

Uri uri = Uri.parse("http://www.example.com/restaurant/sanfrancisco?search=pizza");      
Intent intent = new Intent(Intent.ACTION_VIEW, uri);

The results returned from this code is a single chunk of data. I would like to take this result and display them in a decent format, preferably a list format.
Is there a straight forward way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我很OK 2024-10-07 06:20:16

网上有很多 XML 解析教程。看看他们。您可以使用 SAX 或 DOM 解析器。

http://www.androidpeople.com/android-xml-parsing-教程-使用-saxparser/

There are plenty of XML parsing tutorials on the net. Take a look at them. You can either use a SAX or a DOM parser.

http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文