解析缩略图url虽然在android中的Defaulthandler

时间:2014-12-24 11:11:59

标签: android xml sax

 Below is the single item from XML :
<item>
<guid>http://www.businessinsider.com/european-markets-open-dec-24-2014-2014-12</guid>
                    <title>10 Things You Need Before European Markets Open</title>
                    <link>http://www.businessinsider.com/european-markets-open-dec-24-2014-2014-12</link>
                    <pubDate>Wed, 24 Dec 2014 02:52:00 -0500</pubDate>
<media:thumbnail url="http://static6.businessinsider.com/image/549a70f0dd0895a63a8b4567/10-things-you-need-before-european-markets-open.jpg" />
                                                                <media:credit>REUTERS/Dylan Martinez</media:credit>
                                    </item>

正如您所注意到的所有标签都有结束标签接受媒体:缩略图,我必须从中解析属性网址值。

1 个答案:

答案 0 :(得分:0)

无论是否有其他内容,如果您需要从代码中获取属性,请在覆盖DefaultHandler startElement方法时执行此操作,该方法将使用{{Attributes中的值进行调用1}}参数。

要从此参数获取特定属性名称的值,请使用Attributes getValue方法。

有关解析属性的示例(尽管实际上并未使用getValue方法),请参阅my answer to this related question

相关问题