2012-04-17 72 views
0

我是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的命令。等於(「摘要」)。我無法解析摘要字段中的內容。任何人都可以幫助我?

回答

0

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

教程Link example

乾杯

+0

我試過了。但是這個太複雜了..無論如何感謝您的迴應 – user1338070 2012-10-26 04:55:16

0

試試這個

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

不會幫助。大多數解析器都會失敗。 – 2012-04-17 14:37:42

0

有一次,我跟裏面的html標籤等數據飼料。我的解決方案是要求數據提供商將HTML包裝爲CDATA。所以,如果你有權限訪問xml,請考慮這個選項。