java - Can't read image URL from RSS using Rome API -


my question same in topic found - unable read image url feed using rome api except 2 conditions. so, how read image url:

<item>    <title>dementia in care homes 'more common'</title>     <description>eight out of 10 residents in care homes thought have dementia or severe memory problems, new data shows.</description>     <link>http://www.bbc.co.uk/news/health-21579394#sa-ns_mchannel=rss&amp;ns_source=publicrss20-sa</link>     <guid ispermalink="false">http://www.bbc.co.uk/news/health-21579394</guid>     <pubdate>tue, 26 feb 2013 00:28:31 gmt</pubdate>     <media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/66064000/jpg/_66064884_c0016428-geriatric_care-spl.jpg"/>     <media:thumbnail width="144" height="81" url="http://news.bbcimg.co.uk/media/images/66064000/jpg/_66064885_c0016428-geriatric_care-spl.jpg"/>  </item> 

if markup doen't contain image url info

 list<element> foreignmarkups = (list<element>) entry.getforeignmarkup();  (element foreignmarkup : foreignmarkups) {   string imgurl = foreignmarkup.getattribute("url").getvalue();      //read width , height  } 

and entry.getenclosures() too. looked @ entry structure @ debug mode , haven't found image url. can see media:thumbnail namespases in structure

try rome's media module read urls:

import com.rometools.modules.mediarss.mediaentrymodule; import com.rometools.modules.mediarss.types.thumbnail; import com.rometools.rome.feed.module.module; ... (module module : entry.getmodules()) {     if (module instanceof mediaentrymodule) {         mediaentrymodule media = (mediaentrymodule)module;         (thumbnail thumb : media.getmetadata().getthumbnail()) {             system.out.println(thumb.geturl());         }     } } 

you need rome-modules in classpath work.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -