Returns the full text of the line containing the error.
strValue = oXMLDOMParseError.srcText;
The following script example attempts to load an XML document. If it encounters a parse error, it displays the text of the line containing the error.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
alert(xmlDoc.parseError.srcText);
} else {
alert(xmlDoc.documentElement.xml);
}
strValue = oXMLDOMParseError.srcText
The following Microsoft® Visual Basic® example attempts to load an XML document. If it encounters a parse error, it displays the text of the line containing the error.
Dim xmlDoc As New Msxml2.DOMDocument50
xmlDoc.async = False
xmlDoc.Load ("books.xml")
If xmlDoc.parseError.errorCode <> 0 Then
MsgBox xmlDoc.parseError.srcText
Else
MsgBox xmlDoc.documentElement.xml
End If
HRESULT get_srcText(
BSTR *sourceString);
String. The property is read-only. It returns an empty string if an error is caused by XML that is not well-formed and cannot be assigned to a specific line.
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