c# - How can I get specific links in a class? -


i have html structure this:

<div class="yazardetaytarih_conteiner">     <div class="yazardetaytarih fl">30.mart.2013, cumartesi</div>     <div class="yazardetaybaslik fl"> <a class="haberlink"  href="http://www.hurriyet.com.tr/yazarlar/22928436.asp">böyle özür olmaz serdar ortaç</a>        </div>      </div> <div class="yazardetaytarih_conteiner"> <div class="yazardetaytarih_conteiner"> 

there couple div class="yazardetaytarih_conteiner"> . , want these href links. when write

htmlelementcollection col = web.document.getelementsbytagname("a"); foreach (htmlelement el in col) {        link = el.getattribute("href"); } 

it gives href links @ page. how can take href belongs \a class="haberlink"

edit : couldnt make work. after try richtextbox1.text += el.getattribute("class") gives blank page.

while using nodes can selectnodes("//*[contains(@class,'haberlink')]"); there way this?

inside foreach loop, skip ones not having desired class:

if(el.getattribute("class") != "haberlink")    continue; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -