我正在使用Retrofit 2.2.0和Retrofit SimpleXML Converter 2.2.0。我使用addConverterFactory方法将SimpleXmlConverter添加到Retrofit实例中。
问题是当我收到响应时,它收到以下错误
java.lang.RuntimeException:org.simpleframework.xml.core.ElementException:元素“ subject”在类ResponseEnvelope的第1行不匹配
我应该得到这样的XML响应:
<hismos:Envelope xmlns:hismos="http://www.x3schools.com/xml/2002-08-01" xmlns="http://www.x3schools.com">
<hismos:subject>Reference rates</hismos:subject>
<hismos:Sender>
<hismos:name>Time to Stack Address</hismos:name>
</hismos:Sender>
<Cube>
<Cube time="2018-12-07">
<Cube country="USA" city="CA"/>
</Cube>
</Cube>
@Root(name = "Envelope")@NamespaceList({
@Namespace(prefix = "gesmes", reference = "http://www.gesmes.org/xml/2002-08-01"),
@Namespace(reference = "http://www.ecb.int/vocabulary/2002-08-01/eurofxref")})final class ResponseEnvelope {
@Element
@Namespace(prefix = "gesmes")
private String subject;}