Microsoft XML 2.5 SDK


 

setAttribute Method

[This is preliminary documentation and subject to change.]

Sets the value of the named attribute.

Syntax

oXMLDOMElement.setAttribute(name, value)

Note that the syntax for Visual Basic must omit the parentheses because this method does not return a value.

oXMLDOMElement.setAttribute name, value

Parameters

name

String specifying the name of the attribute. If the attribute with that name already exists, its value is changed. If the attribute with that name does not exist, it is created.

value

Variant that supplies the value for the named attribute.

Remarks

If an attribute with the supplied name already exists, this method changes its value to the supplied value parameter. The supplied string is not parsed, so any markup (such as syntax meant to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out.

To assign an attribute value that contains entity references, the user must create an XMLDOMAttribute object plus any XMLDOMText and XMLDOMEntityReference objects, build the appropriate subtree, and call the setAttributeNode method.

Applies To

XMLDOMElement