I am trying to parse a webpage. But it gives an error. Please help me. Thanks.
Here is the code:
static void myMain() { using (var client = new WebClient()) { string data = client.DownloadString("http://www.google.com"); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(data); var nodes = doc.DocumentNode.SelectNodes("//a[@href]"); foreach (HtmlNode link in nodes) { HtmlAttribute att = link.Attributes["href"]; Console.WriteLine(att.Value); } } }
It gives an error that The type 'System.Windows.Form.HtmlDocument' has no constructors defined. I turned on HAP.
thanks
source share