java - xml解析器在android中获取图像url

标签 java android xml

我想从 xml rss 读取一些数据。例如,这是我的 xml 项目:

    <item>
<title>
Oracle settles with the FTC over 'deceptive' Java security promises
</title>
<pubDate>Mon, 21 Dec 2015 13:39:00 -0800</pubDate>
<author>Katherine Noyes</author>
<dc:creator>Katherine Noyes</dc:creator>
<description>
<![CDATA[
<article> <section class="page"> <p> Security issues have long bedeviled users of Oracle's Java SE, and on Monday the Federal Trade Commission's efforts to address the problem finally came to fruition.</p><p> Oracle agreed to settle <a href="https://www.ftc.gov/system/files/documents/cases/151221oraclecmpt.pdf">charges</a> that it deceived consumers about the security provided by updates to its Java Standard Edition software, which is installed on some 850 million computers around the world, the FTC announced.</p><p> “When a company’s software is on hundreds of millions of computers, it is vital that its statements are true and its security updates actually provide security for the software,” said Jessica Rich, director of the FTC’s Bureau of Consumer Protection.</p><p class="jumpTag"><a href="/article/3017124/java-development/oracle-settles-with-the-ftc-over-deceptive-java-security-promises.html#jump">To read this article in full or to leave a comment, please click here</a></p></section></article>
]]>
</description>
<link>
http://www.computerworld.com/article/3017124/java-development/oracle-settles-with-the-ftc-over-deceptive-java-security-promises.html#tk.rss_all
</link>
<media:thumbnail url="http://zapt0.staticworld.net/images/article/2015/10/20151027-oracle-sun-logo-100625251-primary.idge.jpg"/>
<media:content url="http://zapt0.staticworld.net/images/article/2015/10/20151027-oracle-sun-logo-100625251-primary.idge.jpg"/>
<categories>
<category>Java Development</category>
<category>Application Development</category>
</categories>
</item>

现在我想从中获取图像网址。现在我的代码是:

if(localName.equalsIgnoreCase("enclosure")){
        if(attributes.getValue("media:thumbnail") != null){
            imgurl = attributes.getValue("media:thumbnail").toString();
            Log.d("MyRssParser", imgurl);
        }
    }

但是这段代码似乎有问题。抱歉我的简单问题!我是这个领域的新人! 谢谢你的帮助 。

最佳答案

关于java - xml解析器在android中获取图像url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34411373/

相关文章:

java - 带时间间隔的动态按钮

java - 编码用户界面与拖放

android - GSON:在不使用全局 serializeNulls() 的情况下序列化单个空字段

java - 如何将位图保存到android画廊

java - 在 XPath 1.0 中将整数转换为 double

android - 在 Spinner View Android 中显示最后一项

java - 不支持旧式 JPEG-in-TIFF 数据的解码

java - Java 中的 Rails 闪存消息

java - 添加到数据库时出现空指针异常

android - Facebook Analytics for Apps 中未跟踪 Android 上的 Unity 游戏 Activity 安装