为了账号安全,请及时绑定邮箱和手机立即绑定

SimpleXML:ConstructorException

SimpleXML:ConstructorException

慕标5832272 2021-04-13 16:21:14
我正在尝试解析一些像这样的RSS 2.0提要:https : //audioboom.com/channels/4682117.rss我的模特看起来像这样Rss类(Java文件,Kotlin也给我带来了麻烦)@Root(name = "rss", strict = false)@Namespace(prefix = "itunes", reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")public class RSSFeed {    @Element(name = "title", required = false)    @Path("channel")    public String channelTitle = null;    @Element(name = "description", required = false)    @Path("channel")    public String description = null;    @Element(name = "url", required = false)    @Path("channel/image")    String imageUrl = null;    @ElementList(name = "item", inline = true, required = false)    @Path("channel")    public List<Article> articleList = null;}物品类别(科特林文件)@Root(name = "item", strict = false)@Namespace(prefix = "itunes", reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")class Article{    @set:Path("title")    @get:Path("title")    @set:Text(required = false)    @get:Text(required = false)    var title: String? = null    @set:Element(name = "link", required = false)    @get:Element(name = "link", required = false)    var url: String? = null    @set:Element(name = "enclosure", required = false)    @get:Element(name = "enclosure", required = false)    var enclosure: Enclosure? = null    @set:Element(name = "guid", required = false, data = true)    @get:Element(name = "guid", required = false, data = true)    var id: String? = null    @set:Namespace(reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")    @get:Namespace(reference = "http://www.itunes.com/dtds/podcast-1.0.dtd")    @set:Element(name = "image", required = false)    @get:Element(name = "image", required = false)    var image: Image? = null从我启用Progaurd。我开始出现此错误:java.lang.RuntimeException:org.simpleframework.xml.core.ConstructorException:默认构造函数不能接受方法上的只读@ org.simpleframework.xml.Element(data = false,name = duration,required = false,type = void) com.myapp.model.rss.Article类中的“持续时间”
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 236 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信