Complete Code for the Main Form
The following is the complete code for the main form of the JumpStart application.
Xml Copy Code
Private Sub cmdBrowse_Click()
CommonDialog1.ShowOpen
txtFilePath.Text = CommonDialog1.FileName
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdParse_Click()
Dim reader As New SAXXMLReader360
'Reads the XML document
Dim contentHandler As New ContentHandlerImpl 'Receives parsing events
Dim errorHandler As New ErrorHandlerImpl
'Receive error events
Dim dtdHandler As New DTDHandlerImpl
rtfOutput.Text = ""
Set reader.contentHandler = contentHandler
'They work together
Set reader.errorHandler = errorHandler
'They also work together
Set reader.dtdHandler = dtdHandler
On Error GoTo 10
reader.parseURL (txtFilePath.Text)
'Parse the document
Exit Sub
'That's all, folks!
10: rtfOutput.Text = rtfOutput.Text & "*** Error *** " & Err.Number _
& " : " & Err.Description
End Sub
Private Sub Form_Load()
Dim fso As New FileSystemObject
Dim folder As folder
Dim strSampleFilePath As String
Set folder = fso.GetFolder(".")
strSampleFilePath = fso.GetAbsolutePathName(folder.Path) & "\books.xml"
frmMain.txtFilePath.Text = strSampleFilePath
End Sub