我使用以下链接并解析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> </p>
<p> </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&autoplay=false&vid=13501464&locale=en_US&hasticket=false&id=13501464&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&autoplay=false&vid=13501464&locale=en_US&hasticket=false&id=13501464&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&autoplay=false&vid=13502856&locale=en_US&hasticket=false&id=13502856&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&autoplay=false&vid=13502856&locale=en_US&hasticket=false&id=13502856&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>
我如何只显示有意义的数据。此外,在单击列表视图时,显示此文本的最佳布局是什么以及如何创建它。
答案 0 :(得分:1)
通常,解析器会根据定义忽略CDATA
,但在android中,您可以通过使用nexttoken()
函数找到它然后使用gettext来检索它内部的文本。
您可以在此页面上阅读:http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html