在xml Feed中获取描述
问题描述:
我正在使用以下链接并解析xml字段并在列表视图中显示标题。我的问题是,descrption包含html标签。在xml Feed中获取描述
<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>
我将如何显示只有有意义的数据。同样在点击列表视图什么是最好的布局来显示这个文本,我将如何去创建它。
答
正常情况下,解析器根据定义忽略CDATA
,但在android中,您可以通过使用nexttoken()
函数找到它,然后使用gettext来检索其中的文本。
您可以在此页面上读到它:http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html
你可以找到[这里](http://stackoverflow.com/a/2116191/603127)如何显示TextView的HTML。 – ocanal 2012-04-06 11:21:14
是的。这工作。感谢您的帮助 – user1092042 2012-04-06 11:37:41