我想deserialize
以下xml
:如何反序列化簡單框架中的數組映射?
<scenario name="test responses">
<cmd name="query1">
<return>success_200.xml</return>
<return>error_500.xml</return>
</cmd>
<cmd name="query2">
<return>success_200.xml</return>
</cmd>
</scenario>
到該類
@Root(name="scenario")
public class TestScenario {
@ElementMap(entry="cmd", key="name", attribute=true, inline=true)
private Map<String,StepsList> scenario;
@Attribute(required = false)
private String name = "";
public static class StepsList {
@ElementList(name="return")
private List<String> steps = new ArrayList<String>();
public List<String> getSteps() {
return steps;
}
}
}
卻得到了一個org.simpleframework.xml.core.ValueRequiredException
:無法滿足@org.simpleframework.xml.ElementList
如何可以做到?
檢查:HTTP:// simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#deserialize –