Click to return to the XML (Extensible Markup Language) home page    
IXMLDOMElement::setAttrib...     IXMLDOMElement::tagName P...     IXMLDOMElement Interface    
Web Workshop  |  XML (Extensible Markup Language)

IXMLDOMElement::setAttributeNode Method


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.



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.