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, @cntSet @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 THENfor @cnt = 1 to @rows doSet @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")]%%<table><tr><td>%%=v(@image)=%%</td></tr><tr><td>%%=v(@title)=%%</td></tr><tr><td>%%=v(@desc)=%%</td></tr><tr><td><a href="%%=RedirectTo(@link">Read More</a></td></tr></table>%%[ NEXT @cnt ENDIF ]%%
Can anyone help?