Implementing the ErrorHandler
For the JumpStart application, you create the ErrorHandler by implementing the IVBSAXErrorHandler interface.
To create the ErrorHandlerImpl class
- On the Project menu, click Add Class Module.
- In the Add Class Module dialog box, double-click Class Module.
- On the View menu, select Properties Window.
- In the Properties Window, enter "ErrorHandlerImpl" for the Name property.
To implement the ErrorHandlerImpl class
- In the Class Window, type "Implements", press the spacebar, and then double-click IVBSAXErrorHandler from the drop-down list that appears.
- In the Object drop-down list on the left side of the Class Window, select IVBSAXErrorHandler.
- In the Procedure drop-down list on the right side of the Class Window, select a method or property to add to the class.
- Add the desired code to the selected method or property.
- Repeat steps 3 and 4 until you have added the desired methods and properties.
Note If you have trouble implementing methods and procedures for the
ErrorHandlerImplclass, refer back to Implementing the ContentHandler to see how methods and properties were implemented for theContentHandlerImplclass.
Complete Code for the ErrorHandlerImpl Class
The following is the complete code for the ErrorHandlerImpl class of the JumpStart application.
Option Explicit
Implements IVBSAXErrorHandler
Private Sub IVBSAXErrorHandler_fatalError(ByVal lctr As IVBSAXLocator, _
msg As String, _
ByVal errCode As Long)
Form1.Text2.text = Form1.Text2.text & "*** error *** " & msg
End Sub
Private Sub IVBSAXErrorHandler_error(ByVal lctr As IVBSAXLocator, _
msg As String, ByVal errCode As Long)
End Sub
Private Sub IVBSAXErrorHandler_ignorableWarning( _
ByVal oLocator As MSXML2.IVBSAXLocator, _
strErrorMessage As String, _
ByVal nErrorCode As Long)
End Sub
In the preceding code, only the fatalError method contains code for handling events. For this version of Microsoft® XML Core Services (MSXML) 5.0 for Microsoft Office, only the fatalError method is called for IVBSAXErrorHandler.
