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

时间:2022-04-06 01:05:10

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:

我在android中使用XMLPULLPARSER。我能够从多个Feed中获取所需的所有信息。问题是弄清楚如何可靠地获取从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"/>'

“这名”营养不良“的歌手说她妈妈正试图帮助她吃得更好可靠的Java / Android中的RSS / XML提取解析

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

'可靠的Java / Android中的RSS / XML提取解析在他的On the Road costar Kristen Stewart击中小镇后引起的巨大喧嚣之后,可爱的馅饼Garrett Hedlund显然决定在夏威夷保持低调,而不是......

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

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?

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

1 个解决方案

#1


0  

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

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

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

如果您真的只想获得文本描述,那么您应该看看这里提出的解决方案。

#1


0  

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

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

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

如果您真的只想获得文本描述,那么您应该看看这里提出的解决方案。