IXMLDOMNamedNodeMap::getQualifiedItem

The getQualifiedItem method retrieves the attribute with the specified namespace and attribute name.

HRESULT getQualifiedItem(
BSTR bstrBaseName,
BSTR bstrNamespaceURI,
IXMLDOMNode** ppQualifiedItem
);

Arguments

bstrBaseName

[in] BSTR containing the base name of the attribute, without namespace qualification.

bstrNamespaceURI

[in] BSTR containing the namespace prefix that qualifies the attribute name. It does not matter what value is assigned to this BSTR because the Windows Media Services SDK implementation of the XML DOM does not fully support namespaces.

ppQualifiedItem

[out] Pointer to a pointer to an IXMLDOMNodeIXMLDOMNode Interface representing the attribute node specified by the bstrBaseName and bstrNamespaceURI parameters. Returns NULL if the attribute is not in the collection or if the item is not an attribute. This method calls AddRef internally. To avoid memory leaks, you must call Release when you are finished using the interface.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Remarks

This method is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).

Example

#include “wmsserver.h”
#include <atlbase.h> // Includes CComVariant and CComBSTR.

// Declare variables.
IWMSServer*          pServer;
IXMLDOMDocument*     pPlaylist;
IXMLDOMElement*      pXMLElement;
IXMLDOMNamedNodeMap* pXMLNamedNodeMap;
IXMLDOMNode*         pChildNode;
IXMLDOMNode*         pXMLNode;
IXMLDOMNodeList*     pChildList;

HRESULT              hr;
CComBSTR             bstrName;
CComBSTR             bstrNameURI;
CComVariant          varFile;
VARIANT_BOOL         bIsSuccessful;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer, NULL, CLSCTX_ALL, 
       IID_IWMSServer, (void**)&pServer);
if (FAILED(hr)) goto EXIT;

// Create the playlist object.
hr = pServer->CreatePlaylist(&pPlaylist);

// Load a sample playlist file.
varFile = "c:\\wmpub\\wmroot\\simple.wsx";
hr = pPlaylist->load(varFile, &bIsSuccessful);
if (FAILED(hr)) goto EXIT;

if (bIsSuccessful)
{
    // Retrieve a pointer to the root element interface.
    hr = pPlaylist->get_documentElement(&pXMLElement);
    if (FAILED(hr)) goto EXIT;

    // Retrieve a list of the child nodes.
    hr = pXMLElement->get_childNodes(&pChildList);
    if (FAILED(hr)) goto EXIT;

    // Retrieve the first child in the list.
    hr = pChildList->get_item(0, &pChildNode);
    if (FAILED(hr)) goto EXIT;

    // Retrieve the list of attributes.
    hr = pXMLNode->get_attributes(&pXMLNamedNodeMap);
    if (FAILED(hr)) goto EXIT;

    // Retrieve an attribute named "src".
    bstrName = "src";
    bstrNameURI = "";
    hr = pXMLNamedNodeMap->getQualifiedItem(bstrName bstrNameURI, 
                                                       &pXMLNode);
    if (FAILED(hr)) goto EXIT;
}

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

Requirements

Header: wmsserver.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Reference

IXMLDOMNamedNodeMap Interface

IXMLDOMNode Interface

Concepts

XML DOM Methods (C++)