5 Replies - 770 Views - Last Post: 15 June 2012 - 07:43 AM Rate Topic: -----

#1 nordinho  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-June 12

Beginner question - how do I make VB.NET extract specific data from HT

Posted 14 June 2012 - 10:57 PM

I know how to extract an entire page source into VB.NET, but once I do that how do I make VB.NET search the text and return a specific vlaue that is not constant?

Take this line from the page source for example:

<td id="actualPriceContent"><span id="actualPriceValue"><b class="priceLarge">$4.30</b></span>

the text is always constant but the price is not - how do I make VB.NET return the price?

Thank you for your help!

Is This A Good Question/Topic? 0
  • +

Replies To: Beginner question - how do I make VB.NET extract specific data from HT

#2 kienkiatteo  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 16
  • Joined: 16-May 12

Re: Beginner question - how do I make VB.NET extract specific data from HT

Posted 15 June 2012 - 12:01 AM

Do streamwriter to search for the text, then count it to extract out the data you need.
Was This Post Helpful? 1
  • +
  • -

#3 GodOfCode  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 15-June 12

Re: Beginner question - how do I make VB.NET extract specific data from HT

Posted 15 June 2012 - 01:05 AM

Try using Regular Expression.
Was This Post Helpful? 0
  • +
  • -

#4 nordinho  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-June 12

Re: Beginner question - how do I make VB.NET extract specific data from HT

Posted 15 June 2012 - 06:29 AM

I looked into regular expression but it seems pretty complex to write - especially for beginners like me.

How can I make the streamwriter count?

I was also suggested to use HTML DOM but cannot find a good tutorial on it - can anyone help?

Once again thanks for all the people that replied!
Was This Post Helpful? 0
  • +
  • -

#5 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 221
  • View blog
  • Posts: 1,478
  • Joined: 16-March 11

Re: Beginner question - how do I make VB.NET extract specific data from HT

Posted 15 June 2012 - 07:17 AM

This is what I did. Worked out very well, but I had to create a similar page source, let me know how it works out. I loaded the page with a webbrowser control.

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        For Each element As HtmlElement In WebBrowser1.document.All
            If element.Id = "actualPriceContent" Then
                MessageBox.Show(element.NextSibling.InnerText)
            End If
        Next
    End Sub


This post has been edited by trevster344: 15 June 2012 - 07:17 AM

Was This Post Helpful? 0
  • +
  • -

#6 nordinho  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-June 12

Re: Beginner question - how do I make VB.NET extract specific data from HT

Posted 15 June 2012 - 07:43 AM

Well, regex may not be as complex as I thought. I think I created a string that will do the work:

price is displayed like this in HTML

itemprop="price">$17.95</div>

This regex returns the value 17.95:

(?<=itemprop="price">\$).*?(?=</div>)

Thoughts?

trevster344's suggestions seems interesting too... will be sure to check it out.

Thanks for the help everyone!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1