views:

233

answers:

1

Hi,

I have a Syndication Feed. When serializing using Rss20FeedFormatter I get xmlns:cf and xmlns:cfi namespaces declared in the xml. The media element remains inline.

<media:thumbnail media:url="http://arwen.palantir.za:8080/signate/thumbnail/dXVpZDoxNjlkMzIyOS0zYjk5LTQ2NDctOTc5MS00OTJiYmJmNGM0MTkvUEdTMDkwMC5QREY=" media:width="200" media:height="200" xmlns="http://www.w3.org/2005/Atom" xmlns:a="http://search.yahoo.com/mrss" xmlns:media="http://search.yahoo.com/mrss"&gt;&lt;/media:thumbnail&gt;

I am sure this is why the thumbnails are not displaying correctly. How do I add media:thumbnail and have it work properly. I am using Windows 7 search to view, so it definitely supports the thumbnail.

I would like the media declared in the xml header as it should be.

This is my code:

        item.ElementExtensions.Add(
            new XElement(mrss + "thumbnail",
                new XAttribute(XNamespace.Xmlns + "media", mrss),
                new XAttribute(mrss + "url", url + Convert.ToBase64String(Encoding.ASCII.GetBytes(item.Id))),
                new XAttribute(mrss + "width", 200),
                new XAttribute(mrss + "height", 200)
            ).CreateReader());
A: 

I think this is a case of you just needing to declare your feed namespaces before you use them. I provided an answer on another question which shows how to declare the namespace and then use it in an ElementExtension.

Cragly