HRESULT GetPrefixForURI([in] BSTR NamespaceURI, [out, retval] BSTR * prefix);
This will search the currently active namespaces for the specified namespace URI, and return its current prefix. If not found it will create a new prefix and add it as an active namespace. Typically you don't need to call this, as the methods on the ISerializerOutput interface all take namespace URI's and handle the prefix mappings for you.
The results prefix for this namespace
STDMETHODIMP CMySerializer::Serialize( /*[in]*/ VARIANT *val, ISerializerContext * ctx, /*[in]*/ ISerializerOutput * dest ) { if ( val->vt != VT_BSTR ) return E_UNEXPECTED ; CComPtrn ; ctx->get_Namespaces(&n) ; CComBSTR prefix ; ctx->GetPrefixForURI ( CComBSTR(L"http://schemas.pocketsoap.com/samples/"), &prefix ) ; dest->WriteText(prefix) ; dest->WriteText(CComBSTR(L":")) ; dest->WriteText(val->bstrVal) ; return ; }
Copyright © Simon Fell, 2000-2004. All rights reserved.