简体   繁体   中英

Reliable Parsing for RSS/XML feed in Java/Android

I am using XMLPULLPARSER in android. I am able to get all the information I want from multiple feeds. The issue is figuring out how to reliable get the descriptions parsed from the feeds. The description tag from two of the feeds is as follows:

` 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"/>'

AND

'<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><br/><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/eonl ine/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"/>'

As you can see both are quite different. I have made the information that I want is bolded. There is no CDATA in the description so that option is not viable. I can parse the information I want out of each of them, but I would like an option that works for almost all situation. I am not sure that this is possible, but I have seen a number of RSS readers, podcast readers, that have managed to do third relatively successfully. Any suggestions?

That's html embedded in the description, to show it correctly you could use a webview .

If you really just want to get the text description, you should look at the solutions proposed here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM