I've used html agility pack before, and have had good results with a little bit of trial and error. I'm currently trying to use it to return a node set with an xpath I get by right- clicking "Copy XPath" in Firefox. I've done some searching, and I see that the browser will often add "tbody" for table tags. I tried it with removing this with no luck. Here is the xpath given to me by Firefox:
/html/body/p[3]/table/tbody/tr/td/table/tbody/tr[3]
Using it as- is throws the error: "Value cannot be null. Parameter name: source."
This occurs on line:
nodeList = htmlDoc.DocumentNode.SelectNodes("/html/body/p[3]/table/tbody/tr/td/table/tbody/tr[3]").ToList();
I'll continue to read, in the meantime if this is an easy fix to anyone, I'd appreciate a tip.
Update: This is the actual code:
protected override List<IDataPoint> ReturnDataPointsFromIndividualAddressString(string AddressString)
{
List<IDataPoint> earningsAnnouncements = new List<IDataPoint>(); //Not used, yet..
HtmlWeb hwObject = new HtmlWeb();
HtmlDocument htmlDoc = hwObject.Load(AddressString);
if (htmlDoc.DocumentNode != null)
{
List<HtmlNode> nodeList = new List<HtmlNode>();
nodeList = htmlDoc.DocumentNode.SelectNodes("/html/body/p[3]/table/tbody/tr/td/table/tbody/tr[3]").ToList();
}
}