Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

840 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