On Sat, Jun 30, 2007 at 12:30:24AM +0900, ciocan wrote:
> Hello,
> 
> How can I modify a tag attribute using Hpricot ?
> 
> I.e.
> 
> url = 'http://mysite.com/mypage.html'
> doc = Hpricot(open(url))
> 
> I want to replace from all <img> tags the property src = "imagexxx.jpg"
> with src = "imageyyy.jpg"

(doc/'img').each { |e| e['src'].sub!('imagexxx.jpg', 'imageyyy.jpg') }

> Thanks
--Greg