Sunday, 25 August 2013

How to use regular expretions to remove some html tags from string in java

How to use regular expretions to remove some html tags from string in java

I wrote a code to read news from XML file (Feed) .. and I have to display
the description of each item in my list view ... and I used this peas of
code to remove the html tags exists inside the description tag :
else if ("description".equals(tagName)){
sourcedescription= parser.nextText();
description=Html.fromHtml(sourcedescription).toString();
Log.d("msg", description);
feedDescription.add(description);
}
some items I succeeded to display its description without tags i.e. in an
understood manner , BUT I failed to remove all tags for some other items
which have {iframe} {/iframe} tag ... and I think this tag exists in the
description tags of the items which have "no description"
<description><![CDATA[<p>{iframe height="600"}<a
href="http://admreg.yu.edu.jo/index.php?option=com_content&view=article&id=606:------20132014&catid=87:2011-01-25-18-12-08&Itemid=438">http://admreg.yu.edu.jo/index.php?option=com_content&view=article&id=606:------20132014&catid=87:2011-01-25-18-12-08&Itemid=438</a><span
style="line-height: 1.3em;">{/iframe}</span></p>]]></description>
My question is how to remove the iframe tag by using regular expressions ?

No comments:

Post a Comment