Solved

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

Posted on 2014-01-30
2
586 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

919 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

20 Experts available now in Live!

Get 1:1 Help Now