[Simple-support] Simple - XML reference resolving
Brought to you by:
niallg
|
From: Marc.Waldenberger <Mar...@gm...> - 2016-03-02 09:20:06
|
Hi, i hope this is the correct place to post my question. I tried to read a small XML file <?xml version="1.0" encoding="US-ASCII"?> <Football xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Team> <Player MREF="Foo"/> <Player MREF="Bar"/> </Team> <DESCRIPTION>This is a game</DESCRIPTION> <Player MID="Foo"> <Name>Lionel Messi</Name> </Player> <Player MID="Bar"> <Name>John Lennon</Name> </Player> </Football> but i got an exception: org.simpleframework.xml.strategy.CycleException: Invalid reference 'Foo' found at org.simpleframework.xml.strategy.ReadGraph.readReference(ReadGraph.java:155) at org.simpleframework.xml.strategy.ReadGraph.readInstance(ReadGraph.java:123) so i tried this solution, http://stackoverflow.com/questions/13933314/simple-xml-reference-resolving but then i get the following exception: org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(name=Name, type=void, data=false, required=true) on field 'name' private java.lang.String foo.Player.name for class foo.Player at line 4 at org.simpleframework.xml.core.Composite.validate(Composite.java:644) at org.simpleframework.xml.core.Composite.readElements(Composite.java:449) This is just a small example, i have bigger XML files to parse, but the problems are the same, and i can not change the XML files to have the IDs before the Refs. I created a small test project on github, so if somone want to try it out it is just a click away :D https://github.com/Ohorf/SimpleXMLReferenceTest Thanks in advance. Best Regards, Marc |