1 Replies - 3076 Views - Last Post: 03 July 2012 - 01:26 PM Rate Topic: -----

#1 adn258   User is offline

  • D.I.C Addict

Reputation: 12
  • View blog
  • Posts: 816
  • Joined: 31-August 11

How Can You Get HTML Link Names Using HTML Agility Pack?

Posted 03 July 2012 - 01:18 PM

So I'm trying to just get link names that is what's between >Link Name</a> of a hyperlink in a given amount of hmtl.

 HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(strC);



strC is some html content with hyperlinks. I haven't a clue how to get the names ></a> though in the hyperlinks. There's only a few examples on htmlagilityies site can someone point me in the right direction or is this even possible?

Is This A Good Question/Topic? 0
  • +

Replies To: How Can You Get HTML Link Names Using HTML Agility Pack?

#2 adn258   User is offline

  • D.I.C Addict

Reputation: 12
  • View blog
  • Posts: 816
  • Joined: 31-August 11

Re: How Can You Get HTML Link Names Using HTML Agility Pack?

Posted 03 July 2012 - 01:26 PM

wait a minute I'm sorry sorry guys I found it
doc.LoadHtml(strC);
            HtmlNodeCollection linkNodes = doc.DocumentNode.SelectNodes("//a[@href]");
            MessageBox.Show(linkNodes[0].InnerText);




Thats how you get the selectednodes of links inner text. You can use foreach sorry guys sorry you can close this.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1