2012-03-23 55 views
0

我怎樣才能從HTML字符串中獲取圖像標記。我怎樣才能得到HTML圖像標籤android?

我越來越描述這樣,

<description><![CDATA[<p>23&nbsp;Mar&nbsp;2012</p><a href="http://newsonair.nic.in/news.asp?cat=State&amp;id=ST9197"><p style='FONT-SIZE: 12px; LINE-HEIGHT: 150%' align='justify'> <img style='FLOAT: left; MARGIN-RIGHT: 5px' height='80' width='80' src=http://www.newsonair.nic.in/writereaddata/news_pictures/PICST9197.jpg?0.533424></a><br> The West Bengal Budget for 2012-13 proposes an additional taxation of 200 crore rupees.The budget placed in the State Assembly by the Finance Minister Dr.</p><br clear="all" />]]></description> 

我想僅此鏈接:

http://www.newsonair.nic.in/writereaddata/news_pictures/PICST9197.jpg

如果有誰知道給我一些想法要做到這一點,

感謝。

回答

3

有一百萬的方式做到這一點,這裏是一個:

String url = htmlString.substring(htmlString.lastIndexOf("http"), htmlString.indexOf("jpg")+3); 

編號:

String API

+0

'HTTP' 這顯示無效語法... – Jeeva 2012-03-23 18:43:37

+0

對不起雙引號不是單引號。 – Blundell 2012-03-23 18:45:26

+0

@bundell:這是不正確的方式,因爲我知道解析XML CDATA標籤? – 2012-03-23 18:47:11