[]=( name, value ) public

Sets an attribute, overwriting any existing attribute value by the same name. Namespace is significant.

name

the name of the attribute

value

(optional) If supplied, the value of the attribute. If nil, any existing matching attribute is deleted.

Returns

Owning element

doc = Document.new “<a x:foo=‘1’ foo=‘3’/>” doc.root.attributes[‘y:foo’] = ‘2’ doc.root.attributes[‘foo’] = ‘4’ doc.root.attributes[‘x:foo’] = nil

Show source
Register or log in to add new notes.