0

我正在使用以下链接并解析 xml 字段并在列表视图中显示标题。我的问题是描述包含 html 标签。

<description><![CDATA[<p>We had one of our best episodes yet talking about how to monetize apps through advertisements and how to create custom ones. In addition we taught how to implement analytics in your app and how important analytics are to improving user experience. Our special guest for the show was Scott Mountenay, a web developer who has entered the Android ecosystem. He speaks about his experience, opinions, and favourite things about developing for Android. Join us in another two weeks on April 5th for another great episode.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="296" id="utv206642" name="utv_n_61348"><param name="flashvars" value="loc=%2F&amp;autoplay=false&amp;vid=13501464&amp;locale=en_US&amp;hasticket=false&amp;id=13501464&amp;v3=1" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.ustream.tv/flash/viewer.swf" /><embed flashvars="loc=%2F&amp;autoplay=false&amp;vid=13501464&amp;locale=en_US&amp;hasticket=false&amp;id=13501464&amp;v3=1" width="480" height="296" allowfullscreen="true" allowscriptaccess="always" id="utv206642" name="utv_n_61348" src="http://www.ustream.tv/flash/viewer.swf" type="application/x-shockwave-flash" /></object></p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="296" id="utv418087" name="utv_n_63775"><param name="flashvars" value="loc=%2F&amp;autoplay=false&amp;vid=13502856&amp;locale=en_US&amp;hasticket=false&amp;id=13502856&amp;v3=1" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.ustream.tv/flash/viewer.swf" /><embed flashvars="loc=%2F&amp;autoplay=false&amp;vid=13502856&amp;locale=en_US&amp;hasticket=false&amp;id=13502856&amp;v3=1" width="480" height="296" allowfullscreen="true" allowscriptaccess="always" id="utv418087" name="utv_n_63775" src="http://www.ustream.tv/flash/viewer.swf" type="application/x-shockwave-flash" /></object></p>]]></description>

我将如何只显示有意义的数据。同样在单击列表视图时,显示此文本的最佳布局是什么以及我将如何创建它。

4

1 回答 1

1

通常解析器CDATA会根据定义忽略,但在 android 中,您可以使用nexttoken()函数找到它,然后 gettext 检索其中的文本来获取它。

您可以在此页面上阅读它:http: //developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html

于 2012-04-06T11:28:27.023 回答