url Property (IXMLDOMParseError)
Contains the URL of the XML document containing the last error.
[Script]
Script Syntax
strValue = oXMLDOMParseError.url;
Example
The following script example attempts to load an XML document. If it encounters a parse error, it displays the URL of the document containing the error.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode <> 0) {
var myErr = xmlDoc.parseError;
alert("You have error " + myErr.reason);
} else {
if (xmlDoc.parseError.errorCode != 0) {
alert(xmlDoc.parseError.url);
} else {
alert(xmlDoc.documentElement.xml);
}
}
[Visual Basic]
Visual Basic Syntax
strValue = oXMLDOMParseError.url
Example
The following Microsoft® Visual Basic® example attempts to load an XML document. If it encounters a parse error, it displays the URL of the document containing the error.
Dim xmlDoc As New Msxml2.DOMDocument50
xmlDoc.async = False
xmlDoc.Load ("books.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox("You have error " & myErr.reason)
Else
If xmlDoc.parseError.errorCode <> 0 Then
MsgBox xmlDoc.parseError.URL
Else
MsgBox xmlDoc.documentElement.xml
End If
End If
[C/C++]
C/C++ Syntax
HRESULT get_url(
BSTR *urlString);
Parameters
- urlString [out, retval]
- The URL of the XML file containing the error.
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.
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.
See Also
Applies to: IXMLDOMParseError
