Using cURL to download images in XML feed?

I have an XML file that has links to various .jpg I want to create an applescript that downloads a local copy of these. The idea is to also label them sequentially with a number say 001 to 030.

Every time i run the script i want the pictures to be overwritten with the new ones.

Here is the XML file I need to use: http://tweetriver.com/hud_ro/steer_filtered.xml?include_entities=1

Can anyone help?


If a shell script solution is acceptable as well, try the following

#!/bin/bash
URL='http://tweetriver.com/hud_ro/steer_filtered.xml?include_entities=1'
i=0
for u in $(curl -s "$URL" |
           grep jpg | 
           sed -E 's/.*<profile_image_url>(.+)<\/profile_image_url>/\1/'); do
    curl -s "$u" -o $i.jpg
    (( i++ ))
done

This of course only works for this specific XML example and requires all files to be in jpg format.