Describes the reason for the error.
strValue = oXMLDOMParseError.reason;
The following script example attempts to load an XML document. If it encounters a parse error, it uses the ParseError object's reason property to display the reason the error occurred.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
alert(xmlDoc.parseError.reason);
} else {
alert(xmlDoc.documentElement.xml);
}
strValue = oXMLDOMParseError.reason
The following Microsoft® Visual Basic® example attempts to load an XML document. If it encounters a parse error, it uses the ParseError object's reason property to display the reason the error occurred.
Dim xmlDoc As New Msxml2.DOMDocument50
xmlDoc.async = False
xmlDoc.Load ("books.xml")
If xmlDoc.parseError.errorCode <> 0 Then
MsgBox xmlDoc.parseError.reason
Else
MsgBox xmlDoc.documentElement.xml
End If
HRESULT get_reason(
BSTR *reasonString);
String. The property is read-only. It displays a description of the error. A validation error also includes the URL of the schema and the node within the schema that corresponds to the error.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button
in the upper-left corner of the page.
Applies to: IXMLDOMParseError