Whose bug is it anyway? Google vs Microsoft

.NET, English posts No comments

Consider the following code (.NET):

public static IEnumerable<SyndicationItem> ReadFeed()
{
    IEnumerable<SyndicationItem> ret;

    using (var reader = XmlReader.Create(ListAtomUrl))
    {
        var feed = SyndicationFeed.Load(reader);

        if (feed == null)
            return null;

        ret = feed.Items;

        reader.Close();
    }

    return ret;
}

This is a a simple code to read an ATOM feed, using the relatively new .NET syndication API. When executing it on a Google groups ATOM feed (http://groups.google.com/group/ravendb/feed/atom_v1_0_topics.xml, for example), it would fail miserably with this error:

Error in line 10 position 22.

An error was encountered when parsing a DateTime value in the XML.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: Error in line 10 position 22. An error was encountered when parsing a DateTime value in the XML.

The reason for this error is this XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <updated>-0-0T::Z</updated>
  <generator uri="http://groups.google.com" version="1.99">Google Groups</generator>
  <entry>
  <author>

Notice the "updated" tag. This only happens for the "topics" feed, not the "new messages" feed Google provides for each group.

So whose bug is it? My bet is on Google. Skimming briefly over the ATOM RFC, I could find no mention of a "n/a" value for the "updated" field, so I can't tell if its legit, but this value just doesn't seem right.

However, Microsoft is at fault here too by not providing a way to tolerate those kind of errors. After all, the syndication API is meant to be used with external services, such that the developer would not have access too, and this API renders useless on the slightest bug a feed provider has. Fact is, no other reader I use had problems reading that feed.

Comments

Leave a Comment