Partager via


setAttribute Method

Sets the value of the named attribute.

oXMLDOMElement.setAttribute(name, value);

HRESULT setAttribute(
  BSTR  name,
  VARIANT  value
);

General 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 must be appropriately escaped by the implementation when it is written out.

To assign an attribute value that contains entity references, the user must create IXMLDOMAttribute plus any IXMLDOMText and IXMLDOMEntityReference objects, build the appropriate subtree, and call the setAttributeNode. method

This method applies to the following objects and interfaces:

IXMLDOMAttribute, IXMLDOMElement, IXMLDOMText, and IXMLDOMEntityReference.

See Also

setAttributeNode Method

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.