[Nokogiri-talk] writing attributes to a nokogiri doc

Vamsee Kanakala vamlists at gmail.com
Thu Jun 18 10:11:43 EDT 2009


m.zeckinger wrote:
> hi list, i have a question on how to actually write attributes to
> nodes with nokogiri. i found a way on how this was done in hpricot
> http://seancribbs.com/tech/2008/05/19/modifying-attributes-with-hpricot/
>
> what would be the nokogiri way of doing this? especially how to alter
> and re-read the doc?
>   

With nokogiri this is much simpler:

doc.css('img').each do |element|
   element['src'] = new_src
end


Vamsee.


More information about the Nokogiri-talk mailing list