Skip to content

Instantly share code, notes, and snippets.

@pantos27
Created March 22, 2017 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pantos27/96795cdef99a0081bd1cf998e001f879 to your computer and use it in GitHub Desktop.
Save pantos27/96795cdef99a0081bd1cf998e001f879 to your computer and use it in GitHub Desktop.
RSS feed object with SimpleXML
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