Hi,

I am working on a small application that creates an RSS feed from raw XML data.

While the application itself works as it should, I am trying to add images to each item in the feed, as for instance a Flickr feed.

The problem I am getting is that the code for some reason gets altered when it's loaded into Google Reader.

Here is the code from my app which shows how the description field is formed:

new XElement("description",
        new XCData("<a href=&quot;" + "" + prod.StoreUri + "&quot; " + "target='_blank' title=&quot;" + "" + prod.Name + "&quot; " + "style='outline: none;'><img src=&quot;" + "" + prod.ImageLink + "&quot; " + "border='0' width='240' height='240' style='border-radius: 5px; float: left;' alt=&quot;" + "" + prod.Name + "&quot;" + "></a>" + prod.Description)),

Here is how the output looks after running my application:

<description><![CDATA[<a href=&quot;http://www.cafepress.com/MadTogger.570815356&quot; target='_blank' title=&quot;#BoycottF1OnSky Hashtag Car Magnet 20 x 12&quot; style='outline: none;'><img src=&quot;http://images6.cafepress.com/product/570815356v1_240x240_Front_Color-White.jpg&quot; border='0' width='240' height='240' style='border-radius: 5px; float: left;' alt=&quot;#BoycottF1OnSky Hashtag Car Magnet 20 x 12&quot;></a>Join the rebellion against BSkyB having the only rights to broadcast all the Formula 1 races from 2012 on a Pay-To-View subscription. Keep Formula 1 Free-To-Air on the BBC]]></description>

Now this is what appears in Google Reader:

&lt;a href="http://www.cafepress.com/MadTogger.570815356" target='_blank' title="#BoycottF1OnSky Hashtag Car Magnet 20 x 12" style='outline: none;'&gt;&lt;img src="http://images6.cafepress.com/product/570815356v1_240x240_Front_Color-White.jpg" border='0' width='240' height='240' style='border-radius: 5px; float: left;' alt="#BoycottF1OnSky Hashtag Car Magnet 20 x 12"&gt;&lt;/a&gt;Join the rebellion against BSkyB having the only rights to broadcast all the Formula 1 races from 2012 on a Pay-To-View subscription. Keep Formula 1 Free-To-Air on the BBC

Straight away you can see that Google reader has replaced the '<' & '>' parts of the HTML tags with '&lt;' & '&gt;'.

This I would assume is the only reason why the images are not appearing in each item.

Just incase this is needed, I have included how my 'Description' element is constructed from the original raw XML.

How my Description element is constructed:

Description = (string)prod.Attribute("description"),

Why is Google Reader doing this?

How can I overcome it?

Any help would be greatly appreciated.

Kind regards..,

MT

Hi,

I am working on a small application that creates an RSS feed from raw XML data.

While the application itself works as it should, I am trying to add images to each item in the feed, as for instance a Flickr feed.

The problem I am getting is that the code for some reason gets altered when it's loaded into Google Reader.

Here is the code from my app which shows how the description field is formed:

new XElement("description",
        new XCData("<a href=&quot;" + "" + prod.StoreUri + "&quot; " + "target='_blank' title=&quot;" + "" + prod.Name + "&quot; " + "style='outline: none;'><img src=&quot;" + "" + prod.ImageLink + "&quot; " + "border='0' width='240' height='240' style='border-radius: 5px; float: left;' alt=&quot;" + "" + prod.Name + "&quot;" + "></a>" + prod.Description)),

Here is how the output looks after running my application:

<description><![CDATA[<a href=&quot;http://www.cafepress.com/MadTogger.570815356&quot; target='_blank' title=&quot;#BoycottF1OnSky Hashtag Car Magnet 20 x 12&quot; style='outline: none;'><img src=&quot;http://images6.cafepress.com/product/570815356v1_240x240_Front_Color-White.jpg&quot; border='0' width='240' height='240' style='border-radius: 5px; float: left;' alt=&quot;#BoycottF1OnSky Hashtag Car Magnet 20 x 12&quot;></a>Join the rebellion against BSkyB having the only rights to broadcast all the Formula 1 races from 2012 on a Pay-To-View subscription. Keep Formula 1 Free-To-Air on the BBC]]></description>

Now this is what appears in Google Reader:

&lt;a href="http://www.cafepress.com/MadTogger.570815356" target='_blank' title="#BoycottF1OnSky Hashtag Car Magnet 20 x 12" style='outline: none;'&gt;&lt;img src="http://images6.cafepress.com/product/570815356v1_240x240_Front_Color-White.jpg" border='0' width='240' height='240' style='border-radius: 5px; float: left;' alt="#BoycottF1OnSky Hashtag Car Magnet 20 x 12"&gt;&lt;/a&gt;Join the rebellion against BSkyB having the only rights to broadcast all the Formula 1 races from 2012 on a Pay-To-View subscription. Keep Formula 1 Free-To-Air on the BBC

Straight away you can see that Google reader has replaced the '<' & '>' parts of the HTML tags with '&lt;' & '&gt;'.

This I would assume is the only reason why the images are not appearing in each item.

Just incase this is needed, I have included how my 'Description' element is constructed from the original raw XML.

How my Description element is constructed:

Description = (string)prod.Attribute("description"),

Why is Google Reader doing this?

How can I overcome it?

Any help would be greatly appreciated.

Kind regards..,

MT

Okie dokie, got it sorted now.

A little to do with how my HTML was escaped and the lag with Google Reader.

REVISED code from my app which shows how the description field is formed:

new XElement("description",
        new XCData("<a href=" + "\"" + prod.StoreUri + "\" " + "target=" + "\"" + "_blank" + "\" " + "title=" + "\"" + prod.Name + "\" " + "style=" + "\"" + "outline: none;" + "\"" + "><img src=" + "\"" + prod.ImageLink + "\" " + "border=" + "\"" + "0" + "\" " + "width=" + "\"" + "240" + "\" " + "height=" + "\"" + "240" + "\" " + "style=" + "\"" + "border-radius: 5px; float: left;" + "\" " + "alt=" + "\"" + prod.Name + "\"" + "></a>" + prod.Description)),

Output nows looks like this after running my application:

<description><![CDATA[<a href="http://www.cafepress.com/MadTogger.570815356" target="_blank" title="#BoycottF1OnSky Hashtag Car Magnet 20 x 12" style="outline: none;"><img src="http://images6.cafepress.com/product/570815356v1_240x240_Front_Color-White.jpg" border="0" width="240" height="240" style="border-radius: 5px; float: left;" alt="#BoycottF1OnSky Hashtag Car Magnet 20 x 12"></a>Join the rebellion against BSkyB having the only rights to broadcast all the Formula 1 races from 2012 on a Pay-To-View subscription. Keep Formula 1 Free-To-Air on the BBC]]></description>

Just a few small differences made all the difference.

Regards..,

MT

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.