Xpath/HtmlAgilityPack: Getting the specific attributes from href tag -


i'm using htmlagilitypack parse href tags in html file. href tags this:

<h3 class="product-name"><a href="http://www.somewebsite.com/blahblah" title="click here view product">super cool product</a></h3> 

so far can pull out url , title together, , display in list. main code i'm using parse html:

var linksonpage = lnks in document.documentnode.selectnodes("//h3[@class='product-name']//a")                                                     lnks.attributes["href"] != null &&                              lnks.innertext.trim().length > 0                       select new                       {                           url = lnks.attributes["href"].value,                           text = lnks.innertext                       }; 

the code above gives me result looks this:

super cool product - http://www.somewebsite.com/blahblah 

i'm trying figure out how pull out name , url separately, , put them separate strings, instead of pulling them out , putting them 1 string. i'm guessing there sort of xpath notation can use this. extremely thankful if lead me in right direction

thanks, miles


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -