Reputation: 1275
I am doing RSS parsing by SAX parser and i am getting Description in this format :
<description><![CDATA[<div><b>Start Time:</b> 12/19/2010 6:30 PM</div>
<div><b>End Time:</b> 12/19/2010 10:00 PM</div>
<div><b>Description:</b> Break Guinness World Records of arda</div>
<div><b>Type of Event:</b> <a onclick="OpenPopUpPage('http://www.example.com/_layouts/listform.aspx?PageType=4&ListId={5368B20F-2E1F-4984-9308-3E46442B2336}&ID=79&RootFolder=*', RefreshPage); return false;" href="http://www.example.com/_layouts/listform.aspx?PageType=4&ListId={5368B20F-2E1F-4984-9308-3E46442B2336}&ID=79&RootFolder=*">Aspire closed stadium</a></div>
<div><b>Localization Data:</b> <data><item field="Title" lang="ar-SA"> Break record </item><item field="Description" lang="ar-SA">&lt;P align=right&gt;Break record &amp;nbsp; 9/12/2010 Break record " National " Men Poetry Activities . &lt;/P&gt;</item></data></div>
<div><b>LocationInInteractiveMap:</b> Don't Show</div>
<div><b>Latitude:</b> 25.266024</div>
<div><b>Longitude:</b> 51.443814</div>
<div><b>EventLogo:</b> <img alt="" src="/SiteCollectionImages/Event%20Images/Default.png" style="BORDER: 0px solid; "></div>
]]></description>
so how i am getting tag value from this html code?
Upvotes: 0
Views: 3361
Reputation: 128428
Where you want to display this Description value? If you want to display it inside the TextView
then write:
TextView foo = (TextView)findViewById(R.id.foo);
foo.setText(Html.fromHtml(description));
Or
You can load the Description string value inside the WebView
:
webview.loadData(description, "text/html", null);
Upvotes: 1
Reputation: 109247
Try this,
Html.fromHtml(String source)
Returns displayable styled text from the provided HTML string.
And
Html.fromHtml (String source, Html.ImageGetter imageGetter, Html.TagHandler tagHandler)
Since: API Level 1
Returns displayable styled text from the provided HTML string. Any tags in the HTML will use the specified ImageGetter to request a representation of the image (use null if you don't want this) and the specified TagHandler to handle unknown tags (specify null if you don't want this).
Be sure : Have your source markup be valid HTML?
Upvotes: 1