I\'m trying to add an attribute to an existing Nokogiri node. What I\'ve done is this:
node.attributes[\'foobar\'] = Nokogiri::XML::Attr.new(\'foo\', \'bar\') >
I believe you should just need to use the []= method, i.e.
node['foo'] = 'bar'
You could also use node.set_attribute('foo', 'bar').
node.set_attribute('foo', 'bar')