mardi 4 août 2015

Retrofit with Simpleframework XML

I'm using retrofit to connect to my API and trying to parse messages with Simpleframework XML, but I keep getting the error below:

retrofit.RetrofitError: org.simpleframework.xml.core.ElementException: Element 'head' does not have a match in class Classes at line 5

Here are my classes and XML

@Root(name = "tables")
public class Classes
{
   @ElementList(name = "tables", inline = true)
   List<MyClass> tables;
}

:

Root(name="table")

public class MyClass implements Serializable
{
    @Element(name = "id")
    private String id;

    @Element(name = "name")
    private String name;

    @Element(name = "value")
    private String value;

    @Element(name = "key")
    private String key;
}

XML:

<?xml version="1.0" encoding="UTF-8"?>
<tables>
   <table>
      <id>1</id>
      <name>Admin</name>
      <value>111</value>
      <key>999</key>
   </table>
   <table>
      <id>5</id>
      <name>Bari Limani</name>
      <value>121</value>
      <key>999</key>
</tables>

Aucun commentaire:

Enregistrer un commentaire