Finds the indexed prefix associated with the provided URI. Returns the indexed prefix in the current context. Used for enumeration, this method requests all available prefixes in the current context. The set of prefixes begins at 0. Note that the index value for a prefix can change as the current context changes.
HRESULT _getPrefix [in] const wchar_t* pwszNamespaceURI, [in] long nIndex, [in, out] wchar_t* pwchPrefix, [in, out] int* pcchPrefix);
pwszNamespaceURI
parameter is an empty string or NULL. No prefix can be bound to an empty string.ppchPrefix
is NULL.pcchPrefix
parameter. The pcchPrefix
, parameter specifies the length of the buffer on input, and returns the length of the result on output. The length of the result is returned as a null-terminated string in characters. If the pointer to the buffer is NULL, the getPrefix
method returns only the length.MSXML2::IMXNamespaceManagerPtr PtrIMXNamespaceManager; HRESULT hres; TCHAR Buffer[100]; unsigned short WideCharBuffer[100]; int BufferLength = 100; try { PtrIMXNamespaceManager.CreateInstance( _ __uuidof(MSXML2::MXNamespaceManager)); PtrIMXNamespaceManager->declarePrefix(_T("sample"),_T("urn")); PtrIMXNamespaceManager->declarePrefix(_T("a"),_T("abc")); _itot(PtrIMXNamespaceManager->getDeclaredPrefixes()->length, _ Buffer, BufferLength); DisplayMessageToUser(Buffer); BufferLength = 100; PtrIMXNamespaceManager->_getDeclaredPrefix(2, WideCharBuffer, _ &BufferLength); DisplayMessageToUser(_bstr_t(WideCharBuffer)); BufferLength = 100; PtrIMXNamespaceManager->_getPrefix(L"urn", 0, WideCharBuffer, _ &BufferLength); DisplayMessageToUser(_bstr_t(WideCharBuffer)); BufferLength = 100; hres = PtrIMXNamespaceManager->_getURI(L"sample", NULL, _ WideCharBuffer, _ &BufferLength); DisplayMessageToUser(_bstr_t(WideCharBuffer)); } catch(...) { DisplayMessageToUser("Error"); } } void DisplayMessageToUser(char *Msg) { ::MessageBox(NULL, Msg, _T("Message"), MB_OK);
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.
Applies to: IMXNamespaceManager