我想從這個RSS提要解析數據RSS提要的縮略圖標籤解析圖像鏈接:機器人
http://www.thedailystar.net/frontpage/rss.xml
我使用的AsyncTask,我可以分析,除了「媒體所有其他標籤:縮略圖」 下面的代碼
for (int i = 0; i < items.getLength(); i++) { Node currentchild = items.item(i); if (currentchild.getNodeName().equalsIgnoreCase("item")) { NewsItems item=new NewsItems(); NodeList itemchilds = currentchild.getChildNodes(); for (int j = 0; j < itemchilds.getLength(); j++) { Node current = itemchilds.item(j); if (current.getNodeName().equalsIgnoreCase("title")){ item.setTitle(current.getTextContent()); }else if (current.getNodeName().equalsIgnoreCase("description")){ item.setDescription(current.getTextContent()); }else if (current.getNodeName().equalsIgnoreCase("media:thumbnail")){ item.setMedia(current.getTextContent());//This is not working }else if (current.getNodeName().equalsIgnoreCase("link")){ item.setUrl(current.getTextContent()); } }
我翻看以前回答關於這個問題,但他們都不是爲我工作。
謝謝!
謝謝! 我不得不將它更改爲 current.getAttributes()。getNamedItem(「url」)。getTextContent() – Mufad
非常好!我會更新我的答案。 –