Android REST XML结果到Listview
我有一个REST web服务,它返回如下xml结果:Android REST XML结果到Listview,android,rest,sax,xml-parsing,Android,Rest,Sax,Xml Parsing,我有一个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<
- <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响应。我希望能够使用此结果并在listview中显示它
我怎样才能做到这一点?
谢谢。您需要创建一个自定义SAXParser类 这是一个不错的小礼物 还有(尽管他们没有很好地解释这一点)