Partager via


url Property (DOMDocument)

 

Returns the URL for the last loaded XML document.

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.3.0");
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   WScript.Echo(xmlDoc.url);
}

Visual Basic Syntax

Set objurl = objXMLDOMDocument.url  

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).

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXMLDOMDocument-DOMDocument

See Also

load Method1
save Method (DOMDocument)