Share via


IXMLDOMNamedNodeMap::removeQualifiedItem

banner art

Previous Next

IXMLDOMNamedNodeMap::removeQualifiedItem

The removeQualifiedItem method removes the attribute with the specified namespace and attribute name.

Syntax

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

Parameters

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 IXMLDOMNode interface containing the attribute node removed, or NULL if no node was removed. This method calls AddRef internally. To avoid memory leaks, you must call Release when you are finished using the interface.

Return Values

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 Code

The following example uses the removeQualifiedItem method to remove the attribute node named "src" from the specified element node.

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

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

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

// 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);

// Create a media element.
bstrName = "media";
hr = pPlaylist->createElement(bstrName, &pXMLElement);
if (FAILED(hr)) goto EXIT;

// Set the src attribute for the media element.
bstrName = "src";
varFile = "welcome1.asf";
hr = pXMLElement->setAttribute(bstrName, varFile);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IXMLDOMNamedNodeMap interface.
hr = pXMLElement->get_attributes(&pXMLNamedNodeMap);    

// Remove the newly created attribute.
bstrName = "src";
if (FAILED(hr)) goto EXIT;
bstrNameURI = "";
hr = pXMLNamedNodeMap->removeQualifiedItem(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

Previous Next