Microsoft XML 2.5 SDK


 

IXMLDOMElement::setAttributeNode Method

[This is preliminary documentation and subject to change.]

Adds or changes the supplied attribute node on this element.

Visual Basic Syntax

Set objXMLDOMAttribute = oXMLDOMElement.XMLDOMElement(DOMAttribute)

C/C++ Syntax

HRESULT setAttributeNode(

    IXMLDOMAttribute *DOMAttribute,

    IXMLDOMAttribute **attributeNode);

Parameters

DOMAttribute

[in]
Attribute node that is to be associated with this element.

attributeNode

[out]
NULL unless the new attribute replaces an existing attribute with the same name, in which case this method returns the previous, replaced attribute node.

C/C++ Return Values

S_OK

Value returned if successful.

E_FAIL

Value returned if an error occurs.

Remarks

You cannot add an existing attribute to an element until you first remove it from its previous element. Also, you cannot add a namespace-qualified attribute when it uses the same prefix as another attribute with a different namespaceURI.

C/C++ Example

See Example for getAttributeNode Method