如何解析包含HTML内容的XML

问题描述:

我是Android新手。你能不能帮我解析这个XML包含了像的HTML内容,如何解析包含HTML内容的XML

<title>Jeff Mayweather: Floyd Sr showed a Sign of finally letting go of his Son, Passing Torch to Roger</title> 

<summary type="html"> 
         &lt;p&gt;By Shawn Craddick&lt;/p&gt;&lt;p&gt;&lt;/p&gt; 
&lt;p&gt;Boxingsocialist had a chance to catch up with Floyd Mayweather&#039;s other uncle Jeff Mayweather. While Jeff stays busy at the gym he gave us some updates on his fighters as well as his thoughts on Brandon Rios, Gamboa, Floyd Mayweather Sr and Floyd Jr. meeting back together. Also he talked to us about a surprise boxing veteran he might be working with. Check out the interview below.&lt;/p&gt; 
&lt;p&gt;&lt;br&gt;&lt;/br&gt; &lt;span style=&quot;color: #ff6600;&quot;&gt;BoxingSocialist&lt;/span&gt;- What did you…&lt;/p&gt;     </summary> 

我可以解析冠军领域,为了解析这些摘要场我给在RSS handler-- 的localName的命令。等于(“摘要”)。我无法解析摘要字段中的内容。任何人都可以帮助我?

您可以使用jsoup解析java中的html内容。

教程Link example

干杯

+0

我试过了。但是这个太复杂了..无论如何感谢您的回应 – user1338070 2012-10-26 04:55:16

试试这个

android.text.Html.fromHtml(text).toString(); 
+0

不会帮助。大多数解析器都会失败。 – 2012-04-17 14:37:42

有一次,我跟里面的html标签等数据饲料。我的解决方案是要求数据提供商将HTML包装为CDATA。所以,如果你有权限访问xml,请考虑这个选项。