Set the requested attribute key and value for matched xpath element.

    CLI Example:

    .. code-block:: bash

        salt '*' xml.set_attribute /tmp/test.xml ".//element[@id='3']" editedby "gal"
195817
def set_attribute(file, element, key, value):
    '''
    
    '''
    try:
        root = ET.parse(file)
        element = root.find(element)
    except AttributeError:
        log.error("Unable to find element matching %s", element)
        return False
    element.set(key, str(value))
    root.write(file)
    return True
648510
def call_set_attr(node: Node, key: str, value):
    """"""
    node.set_attr(key, value)
823367
def _edit_config(xpath, element):
    '''
    

    '''
    query = {'type': 'config',
             'action': 'edit',
             'xpath': xpath,
             'element': element}

    response = __proxy__['panos.call'](query)

    return _validate_response(response)
929271
function (element, attr) {
			for (var key in attr) {
				element.setAttribute(key, attr[key]);
			}

			return element;
		}
1349520
def set_attribute_id(self, el, objid):
        '''
        '''
        if self.unique is False:
            el.setAttributeNS(None, 'id', "%s" %objid)
598322
def update_attributes(self, id, old_attrs, new_attrs):
        
        update = dict()
        set_value = {'attributes.' + k: v for k, v in new_attrs.items() if v is not None}
        if set_value:
            update['$set'] = set_value
        unset_value = {'attributes.' + k: v for k, v in new_attrs.items() if v is None}
        if unset_value:
            update['$unset'] = unset_value

        if update:
            response = self.get_db().alerts.update_one({'_id': {'$regex': '^' + id}}, update=update)
            return response.matched_count > 0
330585
def setValue(self, key, value):
        
        parts = nativestring(key).split('/')
        curr = self._xstack[-1]
        for part in parts[:-1]:
            next = curr.find(part)
            if next is None:
                next = ElementTree.SubElement(curr, part)
            curr = next
        
        xval = curr.find(parts[-1])
        if xval is None:
            xval = ElementTree.SubElement(curr, parts[-1])
        
        self.storeValue(xval, value)
871593
def update_xml_element(self):
        

        if not hasattr(self, 'xml_element'):
            self.xml_element = etree.Element(self.name, nsmap=NSMAP)

        self.xml_element.clear()

        if hasattr(self, 'abstract'):
            self.xml_element.set('abstract', self.abstract)
        if hasattr(self, 'prohibitChanges'):
            self.xml_element.set('prohibitChanges', self.prohibitChanges)
        self.xml_element.set('id', self.id)

        for child in self.children:
            if hasattr(child, 'update_xml_element'):
                child.update_xml_element()
                if hasattr(child, 'xml_element'):
                    self.xml_element.append(child.xml_element)

        return self.xml_element
967508
def set_attributes(node, overwrite=True, **attributes):
    
    aset = node.attrs
    for k, v in attributes.items():
        if not overwrite and k in aset:
            pass
        elif v is None:
            if k in aset:
                del aset[k]
        else:
            aset[k] = v
142187
def matches_attributes?(element) # :api: public
      @attributes.all? do |key, value|
        test_attribute(element.attribute(key.to_s), value)
      end
    end
733149
def _set_input(el, value):
        
        if isinstance(value, dict):
            el.value = value["val"]
        elif type(value) in [list, tuple]:
            el.value = ", ".join(item["val"] for item in value)
        else:
            el.value = value
863221
def add_node_attribute(self, node, attr):
        
        self.node_attr[node] = self.node_attr[node] + [attr]
784208
function setAttr(dom, name, val) {
  var xlink = XLINK_REGEX.exec(name);
  if (xlink && xlink[1])
    { dom.setAttributeNS(XLINK_NS, xlink[1], val); }
  else
    { dom.setAttribute(name, val); }
}
1116559
def set(self, key, value):
        
        target = self.registrar
        for element in key.split('.')[:-1]:
            target = target.setdefault(element, dict())
        target[key.split(".")[-1]] = value
639511
def set_attribute(self, id, value, version=1):
        
        attributes = self._get_attributes(cache=True)
        formatted_id = '{0}'.format(id)
        attributes['attributes_values'][formatted_id] = value
        response = self.requester.patch(
            '/{endpoint}/custom-attributes-values/{id}',
            endpoint=self.endpoint, id=self.id,
            payload={
                'attributes_values': attributes['attributes_values'],
                'version': version
            }
        )
        cache_key = self.requester.get_full_url(
            '/{endpoint}/custom-attributes-values/{id}',
            endpoint=self.endpoint, id=self.id
        )
        self.requester.cache.put(cache_key, response)
        return response.json()
323743
def set_attr(self, **kwargs):
        
        for key, value in kwargs.items():
            if value is not None:
                if not isinstance(value, STRING_TYPES):
                    raise ValueError("Set Attr only accepts string values")
                value = c_str(str(value))
            _check_call(_LIB.XGBoosterSetAttr(
                self.handle, c_str(key), value))
178793
def set_attribute(self, name, value):
        """"""
        self.attribute_name = name
        self.attribute = value