asp.net - How to get IMG tag's source from given HTML string using c# -


i getting html string db :-

<p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex</p><img class="classname" alt="alttext" src="http://www.domain.com/uploads/myimage.jpg" width="612" height="612" /><p>going the itinerary, @ official launch on 22nd may.</p><img class="classname" alt="alttext" src="http://www.domain.com/uploads/myimage1.jpg" width="612" height="612" /> 

as can see in string there 2 image tags. want first image tag's source eg :-

http://www.domain.com/uploads/myimage.jpg 

can suggest me how can text html string.

thanks in advance

you can use html parser htmlagilitypack this

string html = ....... htmlagilitypack.htmldocument doc = new htmlagilitypack.htmldocument(); doc.loadhtml(html); var link = doc.documentnode.selectsinglenode("//img").attributes["src"].value; 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -