getURI Method

 

[This feature was first implemented for MSXML 4.0.]

Returns the namespace URI for the specified prefix.

Script Syntax

var strURI = objNSManager.getURI(prefix);  

Parameters

prefix
The prefix bound to the specified namespace URI.

Return Values

A string. The namespace URI for the provided prefix.

Example

See the declarePrefix example for an example of this method.

Visual Basic Syntax

strURI = objNSManager.getURI
(prefix)  

Parameters

prefix
The prefix bound to the specified namespace URI.

Return Values

A variant. The namespace URI for the provided prefix.

Example

See the declarePrefix example for an example of this method.

C/C++ Syntax

HRESULT getURI(  
    BSTR prefix,  
    VARIANT* uri);  

Parameters

prefix[in]
The prefix bound to the specified namespace URI.

uri[out,retval]
The namespace URI for the provided prefix.

Return Values

S_OK
The value returned if successful.

E_FAIL
The value returned if the prefix is not bound to the current context.

E_POINTER
The value returned if the last argument is NULL.

Remarks

An error is raised if a prefix is not declared, or is invalid. This method does not change the current context or stack.

The prefix "xml" is always considered declared, and is permanently bound to "http://www.w3.org/XML/1998/namespace".

The prefix "xmlns" is used only for namespace bindings, and is not itself bound to any namespace name. For prefix "xmlns", getURI returns S_FALSE, because it is not bound to any namespace.

In the following table, the first column shows the sequence of namespace declarations in an XML document. The second and third columns show the requesting prefixes and return values of the getURI method.

Declarations Requesting prefixes Returns
Start of the file
getURI "xml" S_OK, VT_BSTR("http//")
getURI "abc" S_FALSE, VT_NULL
getURI "" S_FALSE, VT_NULL
getURI "xmlns" S_FALSE, VT_NULL
getURI "cdf" S_FALSE, VT_NULL
getDeclaredPrefixes ("xml")
xmlns="urn://1"
xmlns:abc="urn://2"
getURI "xml" S_OK, VT_BSTR("http//")
getURI "abc" S_OK, VT_BSTR("urn://2")
getURI "" S_OK, VT_BSTR("urn://1")
getURI "xmlns" S_FALSE, VT_NULL
getURI "cdf" S_FALSE, VT_NULL
getDeclaredPrefixes ("abc", "", "xml")
getURI "xml" S_OK, VT_BSTR("http//")
getURI "abc" S_OK, VT_BSTR("urn://2")
getURI "" S_FALSE, VT_NULL
getURI "xmlns" S_FALSE, VT_NULL
getURI "cdf" S_FALSE, VT_NULL
getDeclaredPrefixes ("abc", "xml")

Applies to

IVBMXNamespaceManager

Versioning

Implemented in: MSXML 4.0 and later