SimpleXML: Element declared twice

aragon

New Member
I try to parse an xml with the http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#listbtw: there's a similar question here on StackOverflow, but it's a different case, not actually dealing with ElementLists. In my case, I definitely want an ElementList and therefore would assume, the multiple existance of my element should actually be ok.Error log:\[code\]Error parsing xml. org.simpleframework.xml.core.PersistenceException: Element 'gewaessereintrag' declared twice at line 9 at org.simpleframework.xml.core.Variable$Adapter.read(Variable.java:456)....\[/code\]XML:\[code\]<?xml version="1.0" ?><gewaesser> <returncode>0</returncode> <gewaessereintrag> <id>1</id> <name><![CDATA[Entry1]]></name> <info><![CDATA[Info1.]]></info> </gewaessereintrag> <gewaessereintrag> <id>2</id> <name><![CDATA[Entry2]]></name> <info><![CDATA[Info2.]]></info> </gewaessereintrag></gewaesser>\[/code\]WaterList (handling \[code\]<gewaesser>\[/code\]):\[code\]@Root(name = "gewaesser")public class WaterList { @ElementList(type = Water.class, name = "gewaessereintrag") private List<Water> waters; @Element(name = "returncode") private String returncode; public List<Water> getWaters() { return waters; }}\[/code\]Water (handling \[code\]<gewaessereintrag>\[/code\]):\[code\]@Root(name = "gewaessereintrag")public class Water { @Element(required = false, name = "name") private String name; @Element(required = false, name = "info") private String info; @Element(required = false, name = "id", type = Long.class) private Long id;}\[/code\]
 
Back
Top