Dim er As IXMLDOMParseError2
Dim errs As IXMLDOMParseErrorCollection
Dim xd As New DOMDocument50
Dim xs As New XMLSchemaCache50
' Add xs to xd.
xs.Add "urn:books", App.Path & "\books.xsd"
Set xd.schemas = xs
xd.async = False
xd.validateOnParse = False
xd.setProperty "MultipleErrorMessages", True
' Load the XML file to xd.
xd.Load App.Path & "\books.xml"
' Validate the XML.
Set er = xd.Validate
If er.errorCode <> 0 Then
Set errs = er.allErrors
Set er = errs.Next
msg = "errorItem: " & er.reason
Set er = errs.Next
msg = msg & "errorItem: " & er.reason
' Reset to examine the first error again.
errs.Reset
Set er = errs.Next
msg = msg & "errorItem (reset): " & er.reason
Else
msg = "DOM is valid:" & vbCrLf & xd.xml
End If
MsgBox msg
Try It!