This property is a Microsoft extension to the W3C DOM.
ParseError.errorCode
The errorCode property is read-only and returns a decimal error code of the last
parse error.
In the following example the file 'albums.xml' is loaded which includes an error: the slash
(/) is missing from the closing 'category' tag of the first 'Album' element. If a parse error
occurs, as it does in this case, an alert displays the error code.
Note:
Where no parse error occurs, the errorCode property returns 0.
XML:
<Albums>
<Album ref="CD720">
<category>Pop<category>
<title>Come On Over</title>
<artist>Shania Twain</artist>
</Album>
<Album ref="CD024">
<category>Country</category>
<title>Red Dirt Girl</title>
<artist>Emmylou Harris</artist>
</Album>
</Albums>
Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("albums.xml")
Set ParseErr = objXMLDoc.parseError
If ParseErr.errorCode <> 0 Then
alert("Error Code: " & ParseErr.errorCode)
End If
The alert displays the following message:
Output:
Error Code: -1072896659
|