Mufad Mufad - 1 year ago 116
Android Question

Parsing image link from media:thumbnail tag of RSS feed android

I'm trying to parse data from this RSS feed

I'm using AsyncTask and I can parse all other tags except "media:thumbnail"
Here's the code

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")){
}else if (current.getNodeName().equalsIgnoreCase("description")){
}else if (current.getNodeName().equalsIgnoreCase("media:thumbnail")){
item.setMedia(current.getTextContent());//This is not working
}else if (current.getNodeName().equalsIgnoreCase("link")){

I've checked the previous answers regarding this problem, but none of them are working for me.


Answer Source

getTextContent() isn't working because that node doesn't have any text content.

You have to access the "url" attribute of the node.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download