Search notes:

VBA: MSXML and DOM - parseError

After loading (and parsing) an XML document, it is advisable to check whether the document is valid. If not, parseError.errorCode has a value different from zero.
option explicit

sub main() ' {

    dim doc as new MSXML2.DOMDocument

    doc.loadXML("<rootElem><closingTagIsMissing>Not a valid XML document!</rootElem>")

    if doc.parseError.errorCode <> 0 then ' {

       debug.print("Error: " & doc.parseError.reason)
     '
     ' Error: End tag 'rootElem' does not match the start tag 'closingTagIsMissing'.
     '

    end if ' }

end sub ' }
Github repository about-VBA, path: /object-libraries/MSXML/DOM/parseError.bas

See also

MSXML and DOM

Index