1
I’m making a simple example of Retrofit on Android with an XML converter, but every time I run I get the following exception:
java.lang.RuntimeException: org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(data=false, name=title, required=true, type=void) on field 'title' private java.lang.String com.rdev.testes.Channel.title for class com.rdev.testes.Channel at line 2
The format of my XML is:
<rss version="2.0">
<channel>
<title>Testes</title>
<description>Primeira Descrição</description>
<link>http://teste.html</link>
<item>
<title>Teste numero 5 - 31/10/2017</title>
<description>
Descrição teste
</description>
<link>
http://teste.html
</link>
</item>
</channel>
</rss>
Channel Class:
@Root(name="rss", strict=false)
public class Channel {
@Element(name = "title")
private String title;
@Element(name = "description")
private String description;
@Element(name = "link")
private String link;
private Item horoscopeDescription;
public String getTitle() {return title;}
public void setTitle(String title) {this.title = title;}
public String getDescription() { return description;}
public void setDescription(String description) { this.description= description;}
public Item getHoroscopeDescription(){ return this.horoscopeDescription;}
public void setLink(String title) { this.link = link;}
public String getLink(String title) { return link;}
Class Item:
@Root(name="item", Strict=false) public class Item {
@Element(name = "title")
private String title;
@Element(name = "description")
private String description;
public String getTitle() {return title;}
public void setTitle(String title) {this.title = title;}
public String getDescription() {return description;}
public void setDescription(String description) {this.description = description;}
}
I have read several pages on this topic, but I cannot find a solution. Someone can help?