简体   繁体   English

使用Simpleframework XML进行改造

[英]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: 我正在使用翻新连接到我的API,并尝试使用Simpleframework XML解析消息,但是我不断收到以下错误:

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 that I should be getting but Im connecting to an Microsoft asmx service and its returning the html above http://pastebin.com/ASvV0Cwq , somewhere in the soap envelope should be the xml body 这是我应该获取的类和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;
}

This should be the XML: 这应该是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>

XML中缺少终端表标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM