首页 文章

可靠的Java / Android中的RSS / XML提取解析

提问于
浏览
0

我在android中使用XMLPULLPARSER . 我能够从多个Feed中获取所需的所有信息 . 问题在于如何可靠地获取从源解析的描述 . 两个Feed中的description标记如下:

` The "malnourished" singer says her mom is trying to help her eat better <img src = "http://feeds.feedburner.com/~r/people/headlines/~4/of8YOoAtLaA" height = "1" width = "1" />'

'<img src = "http://images.eonline.com/resize/66/66/eol_images/Entire_Site/2011515//300.garfield.lc.061511.jpg" height = "66" width = "66" border = "0" alt = "Andrew Gardield, Garrett Hedlund, Kate Mara" align = "left" hspace = "5" /> After the huge hullabaloo he caused by hitting the town with his On the Road costar Kristen Stewart, cutie-pie Garrett Hedlund apparently decided to keep a low profile in Hawaii with a less ... <br clear= "all" /> <p> <a href= "http://feedads.g.doubleclick.net/~at/kAgHF8uSo-kBC708djx7vWq7S5Y/0/da"> <img src = "http://feedads.g.doubleclick.net/~at/kAgHF8uSo-kBC708djx7vWq7S5Y/0/di" border = "0" ismap = "true"> </ img> </a>
<a href= "http://feedads.g.doubleclick.net/~at/kAgHF8uSo-kBC708djx7vWq7S5Y/1/da"> <img src = "http://feedads.g.doubleclick.net/~at/kAgHF8uSo-kBC708djx7vWq7S5Y/1/di" border = "0" ismap = "true"> </ img> </a> </ p> <div class = "feedflare"> <a href= "http://feeds.eonline.com/~ff/eonline/topstories?a=oSTZWu5LPBA:XlROC-V1kVA:yIl2AUoC8zA"> <img src = "http://feeds.feedburner.com/~ff/eonline/topstories?d=yIl2AUoC8zA" border = "0"> </ img> </a> <a href= "http://feeds.eonline.com/~ff/eonline/topstories?a=oSTZWu5LPBA:XlROC-V1kVA:7Q72WNTAKBA"> <img src = "http://feeds.feedburner.com/~ff/eonline/topstories?d=7Q72WNTAKBA" border = "0"> </ img> </ a> <a href= "http://feeds.eonline.com/~ff/eonline/topstories?a=oSTZWu5LPBA:XlROC-V1kVA:V_sGLiPBpWU"> <img src = "http://feeds.feedburner.com/~ff/eonline/topstories?i=oSTZWu5LPBA:XlROC-V1kVA:V_sGLiPBpWU" border = "0"> </ img> </a> <a href= "http://feeds.eonline.com/~ff/eonline/topstories?a=oSTZWu5LPBA:XlROC-V1kVA:qj6IDK7rITs"> <img src = "http://feeds.feedburner.com/~ff/eonline/topstories?d=qj6IDK7rITs" border = "0"> </ img> </a> </ div> <img src = "http://feeds.feedburner.com/~r/eonline/topstories/~4/oSTZWu5LPBA" height = "1" width = "1" />'

你可以看到两者完全不同 . 我已经将我想要的信息加粗了 . 说明中没有CDATA,因此该选项不可行 . 我可以从他们每个人那里解析我想要的信息,但我想要一个适用于几乎所有情况的选项 . 我不确定这是否可行,但我已经看到一些RSS阅读器,播客阅读器,已经成功地做了第三次 . 有什么建议?

1 回答

  • 0

    这是在描述中嵌入的html,为了正确显示你可以使用webview .

    如果你真的只想获得文字描述,你应该看看提出的解决方案here .

相关问题