You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
public class Persons {
private List<Person> person;
//getters
}
public class Person {
String id_preson;
String name;
PersonalItems personal_items;
//getters
}
public class PersonalItems{
List<Item> item;
//getters
}
public class Item{
String id;
String name;
//getters
}
My Java code:
XmlParserCreator parserCreator = new XmlParserCreator() {
@Override
public XmlPullParser createParser() {
try {
return XmlPullParserFactory.newInstance().newPullParser();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
GsonXml gsonXml = new GsonXmlBuilder()
.setXmlParserCreator(parserCreator)
.setSameNameLists(true)
.create();
Persons persons = gsonXml.fromXml(xml, Persons.class);
The text was updated successfully, but these errors were encountered:
It's interesting. I replaced string "<item>" to "<item id="">". And it works. Looks like it is waiting for id. Even tho all the id's are empty it works. xml = xml.replace("<item>", "<item id=\"\">");
Hi.
I'm having an issue while parsing an XML api response.
It's similar to this issue, but I can't change the XML like he did.
What am I doing wrong ?
My Error:
My XML:
My Model:
My Java code:
The text was updated successfully, but these errors were encountered: