I've been reading into Xpath and trying to find my around with the Agility Pack but this has got me stumped.
HTML Snippet:
<table class="full_width list" cellspacing="0" cellpadding="0">
<tbody><tr>
<td class="w10">
<a href="add_to_slip_wap.t?marketId=28911263.2&outcomeId=159043327.2&numerator=8&denominator=1&handicap=&priceType=EP&ts=1435050302005">
2
</a>
</td>
</tr>
That's enclosed in some other tags but it's a pretty big lump of spam to post the whole thing up and I'm not sure how much is needed. I'm not able to embed images but I've got a screen of Chromes Developer Tools showing all of the tags: https://i.stack.imgur.com/BYHnR.jpg
This table repeats itself and I'm trying to loop around finding the contents of the w10 class. I've tried a lot of different variations but the one which makes sense to me (but obviously doesn't work) is:
For Each node As HtmlNode In document.DocumentNode.SelectNodes("//div/table/tbody/tr/td[@class='w10']")
MsgBox(node.InnerText)
Next
Which returns a System.NullReferenceException. Specifically I'm looking for the anchor text (in this case 2) but variations of [@class='w10']//a don't seem to be working so I think I'm right in assuming it's gone wrong before that.
I looked at the code and followed it through down to find that class and hoped it would be as simple as that. Apparently not. I'm assuming I don't need to start all the way at the top at //html or something but trying to go straight for //[@class='w10'] didn't work either.
If anyone could give me a point in the right direction I'd appreciate it. A lot of the example code I'm finding is for single nodes and they're usually sitting right out in a //div[@class='classname']. Once it starts getting buried in tags I lose the ability to find it.
/Edit:
Big obvious thing I was missing is the xmlns says xhtml which means everything is now in a different namespace. If I figure out what I'm doing I'll update in case anyone is looking for the same kind of thing in future.