So I'm trying to use the Simple Framework to deserialize a simple xml in java. My xml is a huge piece of data, of which I'm posting only the part thats causing me issues.
<item>
<title>Awesome Title</title>
<link>https://awesome_link</link>
<description>Awesome very very long
Description
</description>
<category domain="https://awesome_domain>Awesome Category 1</category>
<category domain="https://awesome_domain”>Awesome Category 2</category>
<category domain="https://awesome_domain”>Awesome Category 3</category>
<category domain="https://awesome_domain”>Awesome Category 4</category>
<pubDate>Wed, 17 Sep 2014 17:57:50 GMT</pubDate>
<author>Awesome author</author>
<guid>Awesome GUID</guid>
<dc:date>Awesome Date</dc:date>
<clearspace:dateToText>3 hours, 35 minutes ago</clearspace:dateToText>
<clearspace:objectType>0</clearspace:objectType>
</item>
For the above, I have created a sample JAVA class called Item that looks something like this
@Root
public class Item {
@Element
private String title;
@Element
private String link;
@Element
private String description;
// @ElementMap(entry = "category", key = "domain", attribute = true, inline
// = true)
// private Map<String, String> map;
@ElementList(entry = "category", inline = true, type = String.class)
private List<String> categoryList;
@Element
private String pubDate;
@Element
private String author;
@Element
private String guid;
@Element
private String date;
@Element
private String dateToText;
@Element
private String objectType;
}
But I am getting the following error
com.android.volley.VolleyError: Unable to satisfy @org.simpleframework.xml.ElementList(data=false, empty=true, entry=category, inline=true, name=, required=true, type=class java.lang.String) on field 'categoryList' private java.util.List com.xx.xx.Item.categoryList for class com.xx.xx.xx.Item at line 210
I've spent almost 2 hours now on this. Anyone has any idea as to what I am doing wrong? I also tried with an ElementMap as seen in the comment, but that didnt work either.
No comments:
Post a Comment