views:

18

answers:

0

I read in the Atom 1.0 spec that for text constructs the type attribute is optional and if left out the processor must behave as if the value was "text".

I'm dealing with a processor (Googlebase, cough..) that doesn't want to see the attribute at all in the feed I'm submitting. Since I'm using the fancy new SyndicationFeed from System.ServiceModel.Web to build my product feed I need to have the formatter not put the type attribute into the output.

My only workaround thus far is to let the formatter write the feed out, then I read it back in and literally replace all instances of type="text" with String.Empty.

Is there a better way of doing this?

var Feed = new SyndicationFeed();
Feed.Title = SyndicationContent.CreatePlaintextContent(@"My Product Feed");
// build feed
// SetupFeed(Feed);
var writer = XmlWriter.Create(@"c:\test.xml");
var formatter = Feed.GetAtom10Formatter();
formatter.WriteTo(writer);
writer.Close();

var text = File.ReadAllText(@"c:\test.xml");
text = text.Replace(@" type=""text""", String.Empty);
File.WriteAllText(File, text);

Everything else about the feed seems to be working fine and I know that I'm now working around what I would say is a clear bug in the processor.