Re: [Simple-support] Using Simple with RSS feed
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-07-03 05:27:25
|
Hi, The prefix here is "atom" so the annotation is @Namespace(prefix="atom", reference="http://www.domain.com/etc") The string "xmlns" is a reserved attribute name used to declare a namespace, it is never a prefix. Niall --- On Mon, 27/6/11, Paul Teale <pt...@xe...> wrote: > From: Paul Teale <pt...@xe...> > Subject: [Simple-support] Using Simple with RSS feed > To: sim...@li... > Received: Monday, 27 June, 2011, 6:24 AM > 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 > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is > seriously valuable. > Why? It contains a definitive record of application > performance, security > threats, fraudulent activity, and more. Splunk takes this > data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |