Re: [Simple-support] ValueRequiredException
Brought to you by:
niallg
|
From: Crundy 12 <cru...@gm...> - 2011-07-27 15:22:13
|
On Fri, Jul 22, 2011 at 10:03 AM, Crundy 12 <cru...@gm...> wrote: > On Thu, Jul 21, 2011 at 10:50 AM, Niall Gallagher > <gal...@ya...> wrote: >> >> Hi, >> >> Your annotations look wrong, @Element does not work with classes, it works only with fields and methods. Instead use @Root for classes. Also, the @ElementList needs to have the name of "enemies" not "enemy". Take a look at the tutorial http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php. >> >> Regards, >> Niall > > Thanks, I did try changing Enemy to use root instead and changed the > ElementList annotation to "enemies" but now I get: > > 07-22 09:04:49.882: WARN/System.err(395): > org.simpleframework.xml.core.ElementException: Element 'enemy' does > not have a match in class my.package.name.Enemies at line 3 > > New code: > > @Root > public class Enemies { > @ElementList(name="enemies") > private List<Enemy> enemyList; > public List<Enemy> getEnemies(){return this.enemyList;} > } > > @Root(name="enemy") > public class Enemy { > @Attribute(name="type") > private int type; > public int getType(){return this.type;} > --etc-- > > Tried naming the enemies class as well: > @Root(name="enemies") > Same error. Anyone? |