我有一个REST Web服务,它返回一个xml结果,如下所示:
- <MyCategories xmlns="http://schemas.datacontract.org/2004/07/ceva" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
- <Category>
<CategoryName>First category</CategoryName>
<Id>1</Id>
</Category>
- <Category>
<CategoryName>Second category</CategoryName>
<Id>2</Id>
</Category>
- <Category>
<CategoryName>Third category</CategoryName>
<Id>3</Id>
</Category>
</MyCategories>
我像这样访问网络服务:
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(WebServiceURL);
request.addHeader("deviceId", deviceId);
BasicResponseHandler handler = new BasicResponseHandler();
result = httpclient.execute(request, handler);
结果我从Web服务获得xml响应。我希望能够使用此结果并将其显示在列表视图中。
我怎样才能做到这一点? 谢谢。