从服务器返回的XML内容:
<root>
<option value="ROW VALUE1">ROW CONTENT1</option>
<option value="ROW VALUE2">ROW CONTENT2</option>
</root>
我对option
对象的表示:
public class Option {
@Element(name = "option")
private String option;
@Attribute(required = false)
private String value;
}
我对Response
对象的表示:
@Root(name = "root")
public class GetOptionsResponse
{
@ElementList(entry = "option", inline = true)
private ArrayList<Option> mOptionList;
}
但是无论何时我试图运行代码并解析它,我得到了:
java.lang.RuntimeException: org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(data=false, name=option, required=true, type=void) on field 'option' private java.lang.String com.packagename.models.Option.option for class com.packagename.models.Option at line 1
我做错了什么?