getPrefixes Method
Returns a collection of namespace prefixes bound to the specified URI.
[Script]
Script Syntax
var objNSPrefixCol = obnNSManager.getPrefixes(namespaceURI)
Parameters
- namespaceURI
- A string. The namespace URI bound to the prefix.
Return Values
An object. Returns the collection of prefixes.
Example
var oNSMgr; try { oNSMgr = new ActiveXObject("Msxml2.MXNamespaceManager.5.0"); oNSMgr.declarePrefix( "sample", "urn"); oNSMgr.declarePrefix ("a", "abc"); alert(oNSMgr.getDeclaredPrefixes.length); // 3 alert(oNSMgr.getDeclaredPrefixes[0]); // "sample" alert(oNSMgr.getURI("sample")); // "urn" alert(oNSMgr.getPrefixes("urn")[0]); // "sample" } catch(e) { alert("Error \n" + e); }
[Visual Basic]
Visual Basic Syntax
set objNSPrefixCol = obnNSManager.getPrefixes(namespaceURI)
Parameters
- namespaceURI
- The namespace URI.
Return Values
An object. Returns the collection of prefixes.
Example
Dim oNSMgr As New Msxml2.MXNamespaceManager50 oNSMgr.declarePrefix "sample", "urn" oNSMgr.declarePrefix "a", "abc" MsgBox oNSMgr.getDeclaredPrefixes.length ' 3 MsgBox oNSMgr.getDeclaredPrefixes.Item(0) ' "sample" MsgBox oNSMgr.getPrefixes("urn").Item(0) ' "sample" MsgBox oNSMgr.getURI("sample") ' "urn"
[C/C++]
C/C++ Syntax
HRESULT getPrefixes( BSTR namespaceURI, IMXNamespacePrefixes** prefixes);
Parameters
- namespaceURI[in]
- The namespace URI.
- prefixes[out, retval]
- The prefixes collection.
C/C++ Return Values
- S_OK
- The value returned if successful.
- E_POINTER
- The value returned if the last parameter is NULL
- E_INVALIDARG
- The value returned if the
namespaceURI
argument is an empty string. A prefix cannot be bound to an empty string. - E_OUTOFMEMORY
- The value returned if there is no memory for
IMXNamespacePrefixes
.
Remarks
When there are no prefixes bound to the specified namespace URI, the returned collection of prefixes contains no items.
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: IVBMXNamespaceManager