Java 简单Xml框架的行为不符合预期
我有以下XML字符串:Java 简单Xml框架的行为不符合预期,java,android,simple-framework,Java,Android,Simple Framework,我有以下XML字符串: String str = "<order id='1234'><orderlines><orderline id='567'>"+ "<article id='890'><description>Bananen</description><todo>45</todo>"+ "</article></orderline></orderlines>
String str = "<order id='1234'><orderlines><orderline id='567'>"+
"<article id='890'><description>Bananen</description><todo>45</todo>"+
"</article></orderline></orderlines></order>";
我希望文章中包含描述和todo元素,但我遇到了以下错误:
05-08 22:45:23.958:D/debug14854:元素“说明”在第1行的nl.rd.svgtest.Orderline类中没有匹配项
我是这样分析的:
Serializer s = new Persister();
Order o = s.read(Order.class, str);
在s.read调用中添加false无效。我找到了答案,如下所示: 我必须将inline=true添加到我的ElementList中,如图所示
Serializer s = new Persister();
Order o = s.read(Order.class, str);