Search code examples
androidksoap2android-ksoap2ksoap

android: kSOAP how to get list of country from an string returned by kSOAP response


My kSOAP web service return the xml into this format how can I fetch country_name from this

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

Solution

  • Arraylist<String> countries = new ArrayList<String>();
    for(int i=0;i<response.getPropertyCount();i++){
    
    countries.add(response.getProperty(i).getPropertyAsString(0));
    
    
    }