2012-04-25 73 views
3

我KSOAP Web服务返回的字符串得到国家的列表中返回的XML转换成这种格式我如何可以获取country_name从这个安卓:KSOAP如何从KSOAP响应

anyType{country=anyType{country_name=Egypt; }; 
    country=anyType{country_name=Pakistan; }; 
    country=anyType{country_name=United Kingdom; }; 
    country=anyType{country_name=United States; }; } 
+2

您能不能告诉你的SOAP响应格式。 – Herry 2012-04-25 11:06:59

+1

你可以参考这个链接http://seesharpgears.blogspot.in/2010/10/ksoap-android-web-service-tutorial-with.html或http://www.helloandroid.com/tutorials/using-ksoap2-机器人和 - 解析 - 输出 - 数据 – 2012-04-25 08:34:48

回答

1
Arraylist<String> countries = new ArrayList<String>(); 
for(int i=0;i<response.getPropertyCount();i++){ 

countries.add(response.getProperty(i).getPropertyAsString(0)); 


}