相关疑难解决方法(0)

参数没有匹配项; SimpleXML的

我使用retrofitSimpleXMLConverterFactory.

我总是得到一个

ConstructorException: Parameter 'success' does not have a match in class ResponseInfo
Run Code Online (Sandbox Code Playgroud)

我不知道会出现什么问题.xml非常简单,我只想要success节点中的字符串.

XML:

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <success>LoremIpsum</success>
</response>
Run Code Online (Sandbox Code Playgroud)

ResponseInfo:

@Root(strict = false, name = "response")
data class ResponseInfo(@Element(required = false, name = "success) var success: String)
Run Code Online (Sandbox Code Playgroud)

编辑1:我测试了Api调用并返回给定的xml.

谢谢

kotlin retrofit2

6
推荐指数
2
解决办法
1627
查看次数

标签 统计

kotlin ×1

retrofit2 ×1