Reputation: 239
Hello everyone I was set up with a Challenge where I must parse through an HTML page to find the end date of all the classes. I am using the HTMLAgilityPack but, this is the first time I have used it, also the webpage who ever set it up has no classes or Id's and the end dates are stored in a Tr H4 tag. I am not sure how to Parse through any hits?
My Code:
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.Load(txtURL.Text);
sw.WriteLine("GET /academics/academic-calendar/ HTTP/1.1");
sw.WriteLine();
String response = sr.ReadToEnd();
txtHTML.Text = response;
Upvotes: 0
Views: 847
Reputation: 50493
Using XPath will allow you to get what you need. Here is an example of how to get all the table rows from the declared html.
HtmlDocument htmlDocument = Markup.Parser();
htmlDocument.LoadHtml(html);
htmlDocument.DocumentNode.SelectNodes("/tr");
Upvotes: 1