Hello all,
When parsing an approximately 4KB XML file with the XMLSax parser library, it takes around 1 minute to complete.
I'm wondering if there's something I'm missing (likely), or if there's an issue specific to my system.
Please see pasted code sample below.
Thank you for your time!
When parsing an approximately 4KB XML file with the XMLSax parser library, it takes around 1 minute to complete.
I'm wondering if there's something I'm missing (likely), or if there's an issue specific to my system.
Please see pasted code sample below.
Thank you for your time!
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim Tidy As Tidy
Dim Sax As SaxParser
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
'MainForm.Show
DownloadQuote
End Sub
Sub DownloadQuote
Dim j As HttpJob
Dim dt,dt1 As Long
j.Initialize("", Me) 'name is empty as it is no longer needed
j.Download("http://livewatch.lebanonema.org/")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Tidy.Initialize
Tidy.Parse(j.GetInputStream, File.DirData("LiveWatchMon"), "temp.xml")
dt=DateTime.now
Try
Dim In As InputStream = File.OpenInput(File.DirData("LiveWatchMon"), "temp.xml")
Log("start parse")
Sax.Initialize
Sax.Parse(In, "sax")
In.Close
Log("finished parse")
Catch
Log(LastException)
End Try
dt1=DateTime.now
Log((dt1-dt) / 1000)
End If
j.Release
End Sub
Sub sax_StartElement (Uri As String, Name As String, Attributes As Attributes)
Log("start element")
End Sub
Sub sax_EndElement (Uri As String, Name As String, text As StringBuilder)
Log("end element")
End Sub