Link Search Menu Expand Document

XmlElement.SetAttribute Method

Explanation Specify the attribute name to set the value of the Attr node.
Not supported in Mobile, AI
Call format elm.SetAttribute( name, value )
Return value None
Arguments String name Attribute name of the Attr node for which you want to set the value
String value Value to set
Exception DOM-5 INVALID_CHARACTER_ERR
DOM-7 NO_MODIFICATION_ALLOWED_ERR
Example of use
    var domimpl = new XmlDOMImplementation;
    var res = session.Get("/test/sample.xml");
    var xmldoc = domimpl.Load(res);
    var elm = xmldoc.DocumentElement;
    elm.SetAttribute("width", "100");
    
Related item XmlAttr class
GetAttribute, RemoveAttribute, HasAttribute, SetAttributeNode, SetAttributeNS, SetAttributeNodeNS method