Hey all I am looking for a way to get this HTML code:
<DIV class=schedule_block>
<DIV class=channel_row><SPAN class=channel>
<DIV class=logo><IMG src='/images/channel_logos/WGNAMER.png'></DIV>
<P><STRONG>2</STRONG><BR>WGNAMER </P></SPAN>
using the HtmlAgilityPack.
I have been trying this:
For Each channel In doc.DocumentNode.SelectNodes(".//div[@class='channel_row']")
Dim info = New Dictionary(Of String, Object)()
With channel
info!Logo = .SelectSingleNode(".//img").Attributes("src").Value
info!Channel = .SelectSingleNode(".//span[@class='channel']").ChildNodes(1).ChildNodes(0).InnerText
info!Station = .SelectSingleNode(".//span[@class='channel']").ChildNodes(1).ChildNodes(2).InnerText
End With
.......
I can get the Logo but it comes up with a blank string for the Channel and for the Station it says
Index was out of range. Must be non-negative and less than the size of
the collection.
I’ve tried all types of combinations:
info!Station = .SelectSingleNode(".//span[@class='channel']").ChildNodes(1).ChildNodes(1).InnerText
info!Station = .SelectSingleNode(".//span[@class='channel']").ChildNodes(1).ChildNodes(3).InnerText
info!Station = .SelectSingleNode(".//span[@class='channel']").ChildNodes(0).ChildNodes(1).InnerText
info!Station = .SelectSingleNode(".//span[@class='channel']").ChildNodes(0).ChildNodes(2).InnerText
info!Station = .SelectSingleNode(".//span[@class='channel']").ChildNodes(0).ChildNodes(3).InnerText
What do I need to do in order to correct this?

If the whitespace is actually there, it counts as a child node. So: