我使用改造连接到我的API并尝试使用Simpleframework XML解析消息,但我不断收到以下错误:
retrofit.RetrofitError: org.simpleframework.xml.core.ElementException: Element 'head' does not have a match in class Classes at line 5
这是我的类和XML,我应该得到但是我连接到Microsoft asmx服务并返回上面的http://pastebin.com/ASvV0Cwq html,肥皂信封中的某个地方应该是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>
答案 0 :(得分:0)
XML中缺少结束表标记。