Android HTTPPost 正文解析

发布于 2024-11-09 07:12:35 字数 1038 浏览 0 评论 0原文

我在解析返回到 Android 应用程序的一些 XML 数据时遇到了很大的挑战。 数据以 XML 形式发送,但将其打印在我的移动屏幕上,结果如下:

{"sessid":"5eed0b52c6953b52e262b559b5557be4","session_name":"SESS6cbf091341a26e4687fa7850b465755a,"user":{"uid":"15","name":"guest","pass":"084e0343a0486ff05530df6c705c8bb4","mail":"[email protected]", "mode":"0","sort":"0","threshold":"0","theme":"","signature":"","signature_format":"0","created":"1306008217","access":"1306094503","login":"1306134979","status":"1","timezone":"3600","language":"","picture":"","init":"[email protected]","data":a:1:{s:13:\"form_build_id\";s:37:\"form-49ea7a4ef10a8a2b31478696f17e8dee\";","form_build_id":"form-49ea7a4ef10a8a2b31478696f17e8dee","roles":{"2":"authenticated user","3":"guest"}}}

任何人都可以帮助新手并给我一些关于如何解析这种类型的输出和/或纯 XML 的想法吗?

I am having a really challenging time parsing some XML data returned to my Android app.
The data is sent as XML but printing it on my mobile screen, it comes out as the following:

{"sessid":"5eed0b52c6953b52e262b559b5557be4","session_name":"SESS6cbf091341a26e4687fa7850b465755a,"user":{"uid":"15","name":"guest","pass":"084e0343a0486ff05530df6c705c8bb4","mail":"[email protected]", "mode":"0","sort":"0","threshold":"0","theme":"","signature":"","signature_format":"0","created":"1306008217","access":"1306094503","login":"1306134979","status":"1","timezone":"3600","language":"","picture":"","init":"[email protected]","data":a:1:{s:13:\"form_build_id\";s:37:\"form-49ea7a4ef10a8a2b31478696f17e8dee\";","form_build_id":"form-49ea7a4ef10a8a2b31478696f17e8dee","roles":{"2":"authenticated user","3":"guest"}}}

Can anyone please help a newbie and give me some ideas on how to parse this type of output and/or plain XML?

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

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

发布评论

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

评论(2

夜声 2024-11-16 07:12:35

这不是 XML,而是 JSON。您必须使用 JSON API 解析该字符串。

基本上,您通过将字符串输入 < 来创建一个 JSONObject代码>JSONTokenizer。您现在可以按照 API 参考示例中的说明从 JSONObject 查询值。

This isn't XML but JSON. You have to parse that string using the JSON API.

Basically you create a JSONObject by feeding the string into a JSONTokenizer. You can now query the values from the JSONObject as described in the API reference example.

飘然心甜 2024-11-16 07:12:35

您在这里看到的字符串是 JSON 格式。您可以使用以下库在 Andriod 中解析此内容:http://code.google.com/p /google-gson/

有关 json 的详细信息,请查看 http://json.org

The String you're seeing here is in JSON format. You can parse this in Andriod using the following library : http://code.google.com/p/google-gson/

For more info on json, checkout http://json.org.

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