0
這裏是我想要的XML解析我有標題和媒體之間飼料分析器一個問題:標題
<item>
<title>Music Monday: Can 'The Whole Love' Compare to Wilco's Best?</title>
<link>...</link>
<comments>...</comments>
<pubDate>Mon, 19 Sep 2011 20:05:24 +0000</pubDate>
<media:title type="html">clairesuddath</media:title>
<media:thumbnail url="http://timenewsfeed.files.wordpress.com/2011/09/98079207.jpg?w=150"/>
</item>
這是我用
public void endElement(String uri, String localName, String qName) throws SAXException {
currentElement = false;
if (currentFeedItem != null) {
if(localName.equals("title")){
currentFeedItem.setTitle(currentValue);
} else if (localName.equals("link")) {
currentFeedItem.setLink(currentValue);
} else if (localName.equals("pubDate")) {
String dateString = currentValue;
try {
Date date = dateFormat.parse(dateString);
currentFeedItem.setPubDate(date);
} catch (ParseException e) {
Log.e("RSSFeed", "ERROR", e);
}
}
else if (localName.equals("item")) {
feedItemList.add(currentFeedItem);
}
}
}
每次我想要得到的代碼標題,我得到媒體:標題。我如何修改我的代碼來解決這個問題?
另一個是如何從媒體獲取網址:縮略圖?
非常感謝。
P.S.對不起,如果我的語法打擾你,我不擅長英語。