Click to return to the XML (Extensible Markup Language) home page    
XMLDOMElement removeAttri...     XMLDOMElement setAttribut...     XMLDOMElement Object    
Web Workshop  |  XML (Extensible Markup Language)

setAttribute Method


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

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
XMLDOMElement


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.