Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Getting information on specific fields of length N in a html file using xpath And placing them in some textbox vb.net

$
0
0
Hello my dear friends at codeplex I am a novice vb.net programmer I'm working on a project that takes a set of data from a series Html file with the same format but with different values ​​I put in some textbox I already used the search function and file operations I do it But because the values ​​are different length in some cases I was having Trouble! After some searching on the internet site and stackoverflow. I noticed there "xpath" and your component(htmlagilitypack) But I do not know how Getting information on specific fields of length N in a html file using xpath my html file in this Format:my html file

I need to have field values ​​that I showed with word "this number" or "this Field" in my html file.zip i need get value of The fields with xpath addres(i i use firebug or inspect element in choreme) and put them to some text box in vb.net tanx a a lot.

for exp see this code
Imports System.Data
Imports System.Net
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Text
Imports System.Text.RegularExpressions
Imports HtmlAgilityPack
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim doc = New HtmlAgilityPack.HtmlDocument
        Dim strAnswer As String = ""

        doc.LoadHtml("C:\Users\T3AS0FT\Desktop\my_html_file\25696.htm")
        'this number (1)
        Dim a As HtmlAgilityPack.HtmlNode =
          doc.DocumentNode.SelectSingleNode("/html/body/center/table/tbody/tr[4]/td/table/tbody/tr[2]/td[2]/table/tbody/tr/td/table[2]/tbody/tr/td[2]/table/tbody/tr[2]/td[8]/strong")
        RichTextBox1.Text = a.InnerText.ToString ''but dont work!!!!

        'this filed(1)
        Dim b As HtmlAgilityPack.HtmlNode =
      doc.DocumentNode.SelectSingleNode("/html/body/center/table/tbody/tr[4]/td/table/tbody/tr[2]/td[2]/table/tbody/tr/td/table[2]/tbody/tr/td[2]/table/tbody/tr[2]/td[5]/p[2]")
        RichTextBox2.Text = b.InnerText.ToString ''but dont work!!!!


        'this number(2)
        Dim c As HtmlAgilityPack.HtmlNode =
      doc.DocumentNode.SelectSingleNode("/html/body/center/table/tbody/tr[4]/td/table/tbody/tr[2]/td[2]/table/tbody/tr/td/table[2]/tbody/tr/td[2]/table/tbody/tr[2]/td[7]/p")
        RichTextBox3.Text = c.InnerText.ToString ''but dont work!!!!
        ' and ...
        ' i use firebug 
        'this code dont work plz help me
    End Sub
End Class
     i use firebug 
    tnx alot

Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>