Cannot consume MediaRss feed generated by Argotic

Topics: Argotic.Core, Argotic.Extensions
Dec 15, 2008 at 4:10 PM
I'm generating an RSS Feed using YahooMediaSyndicationExtension. When I go to consume the feed using Argotic, I get the following exception: The supplied syndication resource has a content format of None, which does not match the expected content format of Rss.

Here's the code I use to consume it:

var settings = new Argotic.Common.SyndicationResourceLoadSettings();
settings.SupportedExtensions.Add(typeof(YahooMediaSyndicationExtension));

RssFeed feed = RssFeed.Create(new Uri("http://localhost/api/GetContent"), settings);

Any ideas what I'm doing wrong?

Dec 15, 2008 at 9:40 PM
More info and a new error...

Got the latest from CodePlex which got rid of the error above. Now I get this: 

"Data at the root level is invalid. Line 1, position 2."

I'm using ASP.NET MVC to generate my feed with a custom ActionResult:

public class RssResult : ActionResult
{
public RssFeed RssFeed { get; set; }
public override void ExecuteResult(ControllerContext context) {
context.HttpContext.Response.ContentType = "application/rss+xml";
SyndicationResourceSaveSettings settings = new SyndicationResourceSaveSettings();
settings.CharacterEncoding = new UTF8Encoding(false);
RssFeed.Save(context.HttpContext.Response.OutputStream, settings);
}
}

I'm pretty sure this has to do with the BOM, which I can't seem to eliminate. Ideas?
Dec 16, 2008 at 5:18 PM
Even more info....

It now appears that SyndicationEncodingUtility.RemoveInvalidXmlHexadecimalCharacters(xml); is mangling the xml. When I change the next line to using(StringReader reader = new StringReader(xml)) instead of safeXml, it works.

The Data at the root level error you can ignore, that was my error.

For now, I've got it working with this. Let me know if you need any more info (like the output of that method).
Coordinator
Jan 27, 2009 at 11:28 PM
Edited Jan 27, 2009 at 11:28 PM
The code to attempt to remove invalid hexadecimal characters from XML is not always working, I may just have to tear it out until I create something more solid. Thanks for the feedback and detailed information.