Partager via


srcText Property

 

Returns the full text of the line containing the error.

Script Syntax

strValue = oXMLDOMParseError.srcText;  

Example

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.3.0");
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
  WScript.Echo(xmlDoc.parseError.srcText);
} else {
  WScript.Echo(xmlDoc.documentElement.xml);
}

Visual Basic Syntax

strValue = oXMLDOMParseError.srcText  

C/C++ Syntax

HRESULT get_srcText(  
    BSTR *sourceString);  

Parameters

sourceString[out, retval]
The full text of the line containing the error. This returns an empty string if the error is caused by XML that is not well-formed and cannot be assigned to a specific line.

C/C++ Return Values

S_OK
The value returned if successful.

S_FALSE
The value returned if no error occurred.

Remarks

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.

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXMLDOMParseError