Exceptions with DateTime parsing in RSS feed use SyndicationFeed in c#

后端 未结 2 873
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 15:21

I\'m trying to parse Rss2, Atom feeds using SyndicationFeed objects. But I\'m getting XmlExceptions while parsing DateTime field like pubDate

2012-01-17 08:01:06

2条回答
  •  爱一瞬间的悲伤
    2020-12-31 16:10

    Basically, that RSS feed is invalid. If you look at the RSS 2.0 specification it states that:

    All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred).

    The string "2012-01-17 12:09:29" doesn't comply to the "Date and Time" part of RFC 822. It should be "17 01 2012 12:09:29" or something similar.

提交回复
热议问题