My XML looks fine. The outer element (sitesAuth) and it's attributes are matched fine..
It then fails when trying to process the name attribute in site...
(It seems like it gets the id first but doesn't like the other attributes)
Error: Unable to satisfy @org.simpleframework.xml.Attribute(name=, empty=, required=true) on field 'name' private java.lang.String
I have tried removing @Root from class.. I've also tried explicitly setting the attributes name with @Attribute(name="name")
<?xml version="1.0" encoding="utf-8"?>
<sitesAuth user_id="24" user_type_id="4">
<site id="24" name="connect.ukctest.public-i.tv" client_id="248" is_PAYG="false">
<language id="1">en_GB</language>
<language id="2">en_GB</language>
</site>
</sitesAuth>
@Root
public class Site {
@ElementList (required=false)
private List<Language> languages;
@Attribute
private int id;
@Attribute
private String name;
@Attribute
private int client_id;
@Attribute
private boolean is_PAYG;
public int getId() {
return new Integer(id).intValue();
}
public int getClientId() {
return new Integer(client_id).intValue();
}
public String getName() {
return name;
}
public boolean getIsPAYG() {
return is_PAYG;
}
public List<Language> getLanguages() {
return languages;
}
}
Aucun commentaire:
Enregistrer un commentaire