[Simple-support] Using Simple with RSS feed
Brought to you by:
niallg
|
From: Paul T. <pt...@xe...> - 2011-06-27 14:26:41
|
I am trying to use Simple XML for handling RSS feeds and am currently annotating the classes used to represent the RSS channel and items. In the RSS feed I am trying to process one of the lines looks like this.. <atom:link href="http://feeds.bbci.co.uk/news/science_and_environment/rss.xml" rel="self" type="application/rss+xml"/> >From what I have read I need to declare the namespace for this to work as it also uses the link tag but I am not very clear on how to do this and the documentation didn't help. I have 3 classes, NewsFeed, Channel and AtomLink listed below with annotations. @Root @Namespace(reference="http://search.yahoo.com/mrss/") public class NewsFeed { @Attribute public String version; @Element @Namespace(reference="http://www.w3.org/2005/Atom", prefix="xmlns") public Channel channel; public Channel getChannel() { return channel; } } @Root @Namespace(reference="http://www.w3.org/2005/Atom") public class Channel { @Element public String title; @Element public String link; @Element public String description; @Element public String language; @Element public String lastBuildDate; @Element public String copyright; @Element public String ttl; @Element @Namespace(reference="http://www.w3.org/2005/Atom") public AtomLink atomLink; } @Root @Namespace(reference="http://www.w3.org/2005/Atom") public class AtomLink { @Element public String href; @Element public String rel; @Element public String type; } When I try this I get the error Element 'link' declared twice at line 13 If anyone can help with why this is happening I would be very grateful. Thanks Paul |