Solved

Getting DIV's with the ID = class='matches' USING HtmlAgilityPack

Posted on 2014-01-30
2
582 Views
Last Modified: 2014-01-30
Anyone able to provide any help on what im missing after the For Each link As HtmlNode In node

	Dim hw As New HtmlWeb()
Dim doc As HtmlDocument = hw.Load("http://www.livefutbol24.com/Football/Live")
	Dim node As HtmlNode = doc.DocumentNode.SelectSingleNode("//div[@class='matches']")
For Each link As HtmlNode In node
	lblHTMLOutput.Text += link.InnerHtml
Next

Open in new window

0
Comment
Question by:runnerjp2005
2 Comments
 
LVL 19

Accepted Solution

by:
Ken Butters earned 500 total points
ID: 39820823
What are you trying to do?    

Is there more than one DIV with class='matches' that you are trying to process?

In order for you to loop through a list of nodes you have to have some sort of array to loop through.   As it stands right now, you only have a single node as a result of "selectSingleNode".

If you had used "selectNodes" instead of "selectSingleNode" the result would have been an array of nodes that you could loop through.
0
 

Author Closing Comment

by:runnerjp2005
ID: 39820937
This is what i did in the end


Dim webGet As New HtmlWeb() 'open the system
        Dim htmlDoc As HtmlDocument = webGet.Load("http://www.livefutbol24.com/Football/Live")'' get the html from the webpage

     

            For Each div As Object In htmlDoc.DocumentNode.SelectNodes("//td[@class='score']")' select all the divs within the code that contain *

            lblHTMLOutput.Text += div.InnerText & "<br>"

        Next
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now