Created
March 22, 2017 15:08
-
-
Save pantos27/96795cdef99a0081bd1cf998e001f879 to your computer and use it in GitHub Desktop.
RSS feed object with SimpleXML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.simpleframework.xml.Element; | |
import org.simpleframework.xml.ElementList; | |
import org.simpleframework.xml.Root; | |
import java.util.List; | |
@Root(name = "channel",strict = false) | |
class Feed { | |
@Element(name = "channel") | |
Channel channel; | |
public Feed() { | |
} | |
@Root(name = "channel",strict = false) | |
public static class Channel{ | |
@Element(name = "title", required = false) | |
private String title; | |
@Element(name = "lastBuildDate", required = false) | |
private String buildDate; | |
@ElementList(inline = true) | |
List<Item> items; | |
public Channel() { | |
} | |
} | |
@Root(name = "item", strict = false) | |
public static class Item { | |
public Item() { | |
} | |
@Element(name = "title") | |
String title; | |
@Element(name = "pubDate") | |
private String pubDate; | |
@Override | |
public String toString() { | |
return title; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment