Hi all,
I have a program that is supposed to parse html. I can run the for loop with for 100 loops or so, but the strings are in the tens of thousands of characters... usually around 21 thousand... My application freezes when I call the Public Sub parser_parse ()...
My main question: Does VB .net 2005 have memory issues when it comes to executing a large string in one pass? Also, I tried adapting the parse to a timer, but the increment variable never incremented.
Notes:
My form name is Root
I took out some of the unrelated code. and strippedd the parser of most of its functions but it still illustrates my issue.
The HTML_txt contains, obviously, the HTML text...
stats is an output window that shows the resulted parsed text
Here's the code:
Public Class Custom_Parser
Public i As Long
Public totalChars As Long
Public currChar As String
Public nextChar As String
Public outString As String
Public currTag As String
Public buildTag As Boolean
Public buildOutString As Boolean
Public Function ParseHTML(ByVal str_input As String)
For Me.i = 0 To Me.totalChars
Me.currChar = str_input.Substring(i, 1)
Root.stats.Text += currChar
Next
Return DBNull.Value
End Function
End Class
Public Class Root
Public myBrowser As New System.Windows.Forms.WebBrowser
Public parser As New Custom_Parser
Private Sub Root_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
HTML_txt.WordWrap = False
parser.i = 0
parser.totalChars = HTML_txt.Text.Length
timer.Enabled = False
End Sub
Public Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer.Tick
Dim HTML_transfer As Boolean = True
If (browser.StatusText = "Done" And HTML_transfer = True) Then
HTML_txt.Text = browser.Document.Body.InnerHtml
'parse_timer.Enabled = True
parser.ParseHTML(HTML_txt.Text)
HTML_transfer = False
timer.Enabled = False
stats.Text = "HTML_txt length: " & HTML_txt.Text.Length
End If
End Sub
End Class
I have a program that is supposed to parse html. I can run the for loop with for 100 loops or so, but the strings are in the tens of thousands of characters... usually around 21 thousand... My application freezes when I call the Public Sub parser_parse ()...
My main question: Does VB .net 2005 have memory issues when it comes to executing a large string in one pass? Also, I tried adapting the parse to a timer, but the increment variable never incremented.
Notes:
My form name is Root
I took out some of the unrelated code. and strippedd the parser of most of its functions but it still illustrates my issue.
The HTML_txt contains, obviously, the HTML text...
stats is an output window that shows the resulted parsed text
Here's the code:
Public Class Custom_Parser
Public i As Long
Public totalChars As Long
Public currChar As String
Public nextChar As String
Public outString As String
Public currTag As String
Public buildTag As Boolean
Public buildOutString As Boolean
Public Function ParseHTML(ByVal str_input As String)
For Me.i = 0 To Me.totalChars
Me.currChar = str_input.Substring(i, 1)
Root.stats.Text += currChar
Next
Return DBNull.Value
End Function
End Class
Public Class Root
Public myBrowser As New System.Windows.Forms.WebBrowser
Public parser As New Custom_Parser
Private Sub Root_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
HTML_txt.WordWrap = False
parser.i = 0
parser.totalChars = HTML_txt.Text.Length
timer.Enabled = False
End Sub
Public Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer.Tick
Dim HTML_transfer As Boolean = True
If (browser.StatusText = "Done" And HTML_transfer = True) Then
HTML_txt.Text = browser.Document.Body.InnerHtml
'parse_timer.Enabled = True
parser.ParseHTML(HTML_txt.Text)
HTML_transfer = False
timer.Enabled = False
stats.Text = "HTML_txt length: " & HTML_txt.Text.Length
End If
End Sub
End Class