【问题标题】:Parsing the XML Response in an Android Application在 Android 应用程序中解析 XML 响应
【发布时间】:2011-04-12 00:46:35
【问题描述】:

我想在我的应用程序中使用 SAX PArser 解析 XML 响应,我不知道该怎么做,所以任何人都可以指导我正确的路径。

一个带有一点编码或链接的例子就可以了。 谢谢, 大卫

【问题讨论】:

    标签: android xml xml-parsing


    【解决方案1】:
    try {
            HttpClient client = new DefaultHttpClient();
            String getURL = <URL>;
            HttpGet get = new HttpGet(getURL);
            HttpResponse responseGet = client.execute(get);
             mResEntityGet = responseGet.getEntity();
            if (mResEntityGet != null) {
                //do something with the response
                content = EntityUtils.toString(mResEntityGet);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    

    "content" 为 XML 格式的字符串,使用 XML pull 解析器解析。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-12
      • 1970-01-01
      • 1970-01-01
      • 2015-01-01
      • 1970-01-01
      相关资源
      最近更新 更多