Hpricot question - how to modify a tag attribute

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 tags the property src = “imagexxx.jpg”
with src = “imageyyy.jpg”

Thanks

On Sat, Jun 30, 2007 at 12:30:24AM +0900, ciocan wrote:

with src = “imageyyy.jpg”
(doc/‘img’).each { |e| e[‘src’].sub!(‘imagexxx.jpg’, ‘imageyyy.jpg’) }

Thanks
–Greg