在我的应用程序中读取RSS时出错

时间:2017-04-12 22:16:13

标签: android rss-reader

这是我在尝试阅读RSS时的错误我不明白它来自哪里,我只知道它在Item类和Content类之间我已经移动了一千种但我不知道它是什么< / p>

> 04-12 17:07:54.454 381-467/com.herprogramacin.hermosaprogramacion
> W/System.err:     at
> com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:123)
> 04-12 17:07:54.454 381-381/com.herprogramacin.hermosaprogramacion
> D/MainActivity: Error Volley:
> org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy
> @org.simpleframework.xml.Element(data=false, name=content,
> required=true, type=void) on field 'content' private
> com.herprogramacin.hermosaprogramacion.RssParse.Content
> com.herprogramacin.hermosaprogramacion.RssParse.Item.content for class
> com.herprogramacin.hermosaprogramacion.RssParse.Item at line 95

这是Feed:https://www.forbes.com/most-popular/feed/

这是我的班级:

Item.java

@Root(name = "item", strict = false)
public class Item {

    @Element(name="title")
    private String title;

    @Element(name = "description")
    private String descripcion;

    @Element(name="link")
    private String link;

    @Element(name="content")
    @Namespace(reference="http://search.yahoo.com/mrss/", prefix="media")
    private Content content;



    public Item() {
    }

    public Item(String title, String descripcion, String link, Content content) {
        this.title = title;
        this.descripcion = descripcion;
        this.link = link;
        this.content = content;
    }

    public String getTitle() {
        return title;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public String getLink() {
        return link;
    }

    public Content getContent() {
        return content;
    }
}

Content.java

@Root(name="media", strict = false)
public class Content {

    @Attribute(name="url")
    private String url;

    public Content() {
    }

    public Content(String url) {
        this.url = url;
    }

    public String getUrl() {
        return url;
    }
}

我不明白错误是什么......

0 个答案:

没有答案