url Property (DOMDocument)

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

url Property (DOMDocument)

Returns the URL for the last loaded XML document.

[Script]

Script Syntax

var objurl = objXMLDOMDocument.url;

Example

The following script example creates a DOMDocument and displays the value of its url property.

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 {
   alert(xmlDoc.url);
}
[Visual Basic]

Visual Basic Syntax

Set objurl = objXMLDOMDocument.url

Example

The following Microsoft® Visual Basic® example creates a DOMDocument and displays the value of its url property.

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
   MsgBox xmlDoc.URL
End If
[C/C++]

C/C++ Syntax

HRESULT get_url(
    BSTR *urlString);

Parameters

urlString [out, retval]
The URL from the last successful load. If the document is being built in memory, this property returns Null.

C/C++ Return Values

S_OK
Value returned if successful.
S_FALSE
Value returned if there is no URL.
E_INVALIDARG
Value returned if the urlString parameter is Null.

Remarks

String. The property is read-only. It returns the URL from the last successful load. If the document is being built in memory, this property returns Null.

The url property is not updated after saving a document with the save method. To update the url property, reload the document using the load method.

This member is an extension of the Worldwide Web Consortium (W3C) Document Object Model (DOM).

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

load Method | save Method

Applies to: DOMDocument