I am trying to use org.simpleframework.xml
. classes to handle xml data on my Android project. I can't understand how to build my class "Point" contructor to match the xml definition: at run-time I get this exception:
org.simpleframework.xml.core.PersistenceException: Constructor not matched for class koine.marcos.wifidemo.Point
My xml data is like this:
File points.xml:
<?xml version="1.0" encoding="utf-8"?>
<points>
<point id="La Gioconda">
<rssi ssid="beacon1" bssid="00:21:91:d1:36:62">-52</rssi>
<rssi ssid="beacon2" bssid="00:12:a9:03:23:32">-97</rssi>
</point>
<point id="La Pietà">
<rssi ssid="beacon1" bssid="00:21:91:d1:36:62">-68</rssi>
<rssi ssid="beacon2" bssid="00:12:a9:03:23:32">-83</rssi>
</point>
</points>
File Rssi.java:
@Root
public class Rssi {
@Attribute(required=false)
protected String id;
@Element(required=false)
protected Integer value;
... getters and setters ...
}
File point.java:
@Root
public class Point {
@Attribute
protected String id;
@ElementMap(entry="rssi", key="id", attribute=false,
inline=true, required=false)
private Map<String,Integer> rssiMap;
public Point(String id, Map<String,Integer>rssi) {
this.id = id;
...
}
...
}
File Points:java:
@Element
public class Points {
@ElementList(inline=true, required=true)
private List<Point> list;
... getters and setters ...
}