IXMLDOMElement.removeAttribute (C#)

The removeAttribute method removes or replaces the named attribute.

IXMLDOMElement.removeAttribute(
  string strName
);

Arguments

strName

[in] string specifying the name of the attribute to be removed or replaced.

Return Value

This method does not return a value.

Example

The following example removes the attribute node named "src" from the specified element node.

using Microsoft.WindowsMediaServices.Interop;
using interop_msxml;

// Declare variables.
WMSServer Server;
IXMLDOMDocument Playlist;
IXMLDOMNodeList ElemList;
IXMLDOMElement Elem;
IXMLDOMNode Node;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Create a new playlist object.
    Playlist = Server.CreatePlaylist();

    // Load a playlist.
    Playlist.load("file://c:\\wmpub\\wmroot\\simple.wsx");

    // Retrieve a list of nodes that match the query.
    ElemList = Playlist.getElementsByTagName("media");

    // Retrieve the first node in the list.
    Node = ElemList[0];

    // Box the first node into an IXMLDOMElement object.
    Elem = (IXMLDOMElement)Node;

    // Remove attribute named "src".
    Elem.removeAttribute("src");
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add references to Microsoft.WindowsMediaServices and interop_msxml.

Namespace: Microsoft.WindowsMediaServices.Interop, interop_msxml.

Assembly: Microsoft.WindowsMediaServices.dll, interop_msxml.dll.

Library: WMSServerTypeLib.dll, msxml.dll.

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

See Also

Reference

IXMLDOMElement Object (C#)

Concepts

XML DOM Methods (C#)