I've been following this article on how to get retrofit to work with xml... which works.
How to use Retrofit and SimpleXML together in downloading and parsing an XML file from a site?
But It needs to work with a callback. And I just cant get it work.
Has any one else done one?
public class LocksXmlDisplay {
@Root(name = "breakfast_menu")
public class BreakFastMenu
{
@ElementList(inline = true)
List<Food> foodList;
}
@Root(name="food")
public class Food
{
@Element(name = "name")
String name;
@Element(name = "price")
String price;
@Element(name = "description")
String description;
@Element(name = "calories")
String calories;
}
public BreakFastMenu breakFastMenu;
}
public interface GetKnocksInter {
@GET("/simple.xml")
//LocksXmlDisplay getxml();
void fetchxml(Callback<List<LocksXmlDisplay.Food>> mycallback);
}
getKnocksInter.fetchxml(new Callback<List<LocksXmlDisplay.Food>>() {
@Override
public void success(List<LocksXmlDisplay.Food> foods, Response response) {
}
@Override
public void failure(RetrofitError error) {
}
});