Removes or replaces the named attribute.
oXMLDOMElement.removeAttribute(name)
HRESULT removeAttribute( BSTR name);
If the specified attribute has a default value, this is equivalent to a replace operation: The current value is removed and a new attribute is created with the default value. This operation also resets the IXMLDOMNode interface's specified property.
IXMLDOMElement *pIXMLDOMElement = NULL; _bstr_t bstrAttributeName = _T("dateCreated"); IXMLDOMDocument *pIXMLDOMDocument = NULL; HRESULT hr; try { // Create an instance of DOMDocument and initialize pIXMLDOMDocument. // Load/create an XML fragment. hr = pIXMLDOMDocument->get_documentElement(&pIXMLDOMElement); SUCCEEDED(hr) ? 0 : throw hr; hr = pIXMLDOMElement->removeAttribute(bstrAttributeName); if(SUCCEEDED(hr)) { // Attribute removed. } pIXMLDOMElement->Release(); pIXMLDOMElement = NULL; // Release pIXMLDOMDocument when finished with it. } catch(...) { // Release pIXMLDOMDocument if it exists. if(pIXMLDOMElement) pIXMLDOMElement->Release(); DisplayErrorToUser(); }