I am using the following vb6 function to validate my xml against its schema file:


Function ValidateAsXmlFile(strFileName As String) As Boolean

Dim xmlDoc As MSXML2.DOMDocument50

Set xmlDoc = New MSXML2.DOMDocument50

xmlDoc.validateOnParse = True
xmlDoc.async = False
xmlDoc.Load (strFileName)

Select Case xmlDoc.parseError.errorCode
Case 0 ' Passed Validation
ValidateAsXmlFile = True
Case Else ' Failed Validation
ValidateAsXmlFile = False
MsgBox vbCrLf & "ERROR! Failed to validate " & _
strFileName & vbCrLf & xmlDoc.parseError.reason & vbCrLf & _
"Error code: " & xmlDoc.parseError.errorCode & vbCrLf & "Line: " & _
xmlDoc.parseError.Line & vbCrLf & "Character: " & _
xmlDoc.parseError.linepos & "", vbExclamation, "XML Failed to Validate Against Schema"
End Select

Set xmlDoc = Nothing

End Function


This works fine except that it only identifies the 1st error. You can't tell if there are follow-on errors. Once you correct this error and re-validate then you may find a 2nd error and so on. I would like to be able to see all errors at once. Any ideas?


Tim