XML DOM » ParseError » errorCode

Compability: Internet Explorer

Syntax:
parseError.errorCode

This property is read-only and contains the error code of the last parse error.

Note:
Where no parse error occurs, the errorCode property returns 0.

Examples

Code:
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>

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
Output:
Error Code: -1072896659
Explanation:

In this 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.

Language(s): VBScript XML