Results 1 to 4 of 4

Thread: Where can I find a tutorial on parsing html elements?

  1. #1

    Thread Starter
    Hyperactive Member simpleonline1234's Avatar
    Join Date
    Mar 2010
    Posts
    322

    Where can I find a tutorial on parsing html elements?

    I'm still learning the ropes in VB.NET and I'm currently up to a point in a current project where I would need to parse links on an html website once the information has been downloaded to the document completed section of my web browser.

    Does anyone know of a guide/tutorial that is newbie friendly?

    Thanks

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Where can I find a tutorial on parsing html elements?

    There are a few options:

    1. Depending on how complex of string manipulation you are doing you might be able to get away with the methods available in the String class
    2. Use a third party library like the Html Agility Pack
    3. If you don't want to use a third party library you could also use Regular Expressions, which if you google, will get a lot of hits

  3. #3
    Frenzied Member stateofidleness's Avatar
    Join Date
    Jan 2009
    Posts
    1,780

    Re: Where can I find a tutorial on parsing html elements?

    The HTML Agility Pack is great for this.
    I also cover a lot of Web Scraping stuff on my blog (see sig).

  4. #4
    Banned
    Join Date
    Mar 2009
    Posts
    764

    Re: Where can I find a tutorial on parsing html elements?

    43 regex get the string in a defined middle

    Code:
    Imports System
    Imports System.Text.RegularExpressions
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim mCollect As MatchCollection = Regex.Matches("sjlfhal{yes}djklafh{yess}", "(?<={).*?(?=})", RegexOptions.IgnoreCase)
    
            For Each m As Match In mCollect
                MsgBox(m.Value)
            Next
        End Sub
    End Class
    
    ' output : yes yess

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width