当我通过HttpPost发布url时,我得到了以下字符串作为响应。我的问题是如何解析这个字符串。
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1">
<head>
<status>200</status>
</head>
<body>
<outline type="object" text="account">
<account>
<guide_id>u36710162</guide_id>
<username>xyz</username>
<session_id>9d28d854-bd31-4bba-9a5f-4e5cd88edaac</session_id>
<first_name />
<last_name />
<email>xyz@gmail.com</email>
</account>
</outline>
</body>
</opml>如何从该字符串中获取status、guide_id、username、session_id、first_name、last_name和email。
提前感谢...!
发布于 2012-06-08 13:24:30
它是一个XML格式的响应。您可以通过、或对其进行解析。
关于status,您可以从HTTP本身获得它。
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httpRequest);
response.getStatusLine().getStatusCode()注意:考虑将<account>作为您的父标记。
https://stackoverflow.com/questions/10943454
复制相似问题