Dim xmlDoc As New Msxml2.DOMDocument30 xmlDoc.async = False xmlDoc.validateOnParse = True xmlDoc.Load "books.xml" If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) End Ifor achieve the same thing after loading with:
Dim xmlDoc As New Msxml2.DOMDocument30 xmlDoc.async = False xmlDoc.Load "books.xml" xmlDoc.Validate If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) End IfThe benefit of the later is that you can load the doc, add/change nodes and validate the modified result.