I am embedding an RSS feed in an email using AMPScript. I am successfully pulling in the title, description and link, but I’d also like to include the image that’s part of the description in the feed. However, I cannot figure out the syntax to use, as the image is wrapped in a CDATA tag

Here is the link to the RSS feed I am using: http://rssfeeds.militarytimes.com/militarytimes/newsletters/roundup&x=1

It also lists the image url in an enclosure tag with a url= but I not sure how I would need to grab that either.

The code I am using in the email is:

%%[Var @xml, @titles, @title, @descs, @desc, @links, @link, @images, @image, @cnt
Set @xml = ContentAreaByName("my contents\RSSParse-MilitaryTimes-DailyRoundup")
Set @titles = BuildRowsetFromXML(@xml,"//item/title",1)
Set @descs = BuildRowsetFromXML(@xml,"//item/description",1)
Set @links = BuildRowsetFromXML(@xml,"//item/link",1)
Set @images = BuildRowsetFromXML(@xml,"//item/enclosure",1)

Set @rows = RowCount(@titles)

IF @rows >= 1 THEN
for @cnt = 1 to @rows do
Set @title = Field(Row(@titles,@cnt),"Value")
Set @desc = Field(Row(@descs,@cnt), "Value")
Set @link = Field(Row(@links,@cnt), "Value") 
Set @image = Field(Row(@images,@cnt), "Value")]%%
        <td><a href="%%=RedirectTo(@link">Read More</a></td>
    NEXT @cnt

Can anyone help?

  • Your RedirectTo call is incomplete and should read "%%=RedirectTo(@link)=%%" . Is that typo in your main code?
    – Timothy
    Nov 7, 2014 at 17:02

1 Answer 1


You could just parse the image URL from description node like this:


 var @desc, @temp, @image
 set @desc = 'extra text here <img border="0" style="max-width:100%" src="http://www.gannett-cdn.com/-mm-/e1256297e1227e7964c701fecfef8825a86edefe/r=916x200/local/-/media/GGM/None/2014/10/16/635490534337074523-hov-bgillustration-logo-920a.jpg"/> more extra text'

 /* trim the beginning */
 set @temp = substring(@desc,add(indexOf(@desc,"src="),5),length(@desc))

 /* trim the end */  
 set @image = substring(@temp,1,subtract(indexOf(@temp,'"'),1))  



That results in this:


For more information

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .