Estoy intentando analizar alimentaciones Rss2, Atom utilizando objetos SyndicationFeed. Pero me estoy XmlExceptions al analizar el campo DateTime como pubDateExcepciones con el análisis de DateTime en la fuente RSS use SyndicationFeed en C#
2012-01-17 08:01:06
public static List<SyndicationItem> getRssData(string url)
{
List<SyndicationItem> list = new List<SyndicationItem>();
WebClient client = new WebClient();
try
{
SyndicationFeed feed = SyndicationFeed.Load(XmlReader.Create(url));
list = (from item in feed.Items select item).ToList();
}
catch (Exception e)
{
throw e;
}
return list;
}
el enlace URL http://news.163.com/special/00011K6L/rss_newstop.xml
<item id="2">
<title>...</title>
<link>...</link>
<description>......</description>
<pubDate>2012-01-17 12:09:29</pubDate><-----Exception
</item>
¿Hay una mejor manera de ¿lograr esto? Por favor ayuda. Gracias.
Solo por curiosidad, ¿por qué estás usando una expresión de consulta LINQ para obtener la lista? Es equivalente a 'list = feed.Items.ToList();'. No es parte del problema, pero aun así ... (Del mismo modo, por favor no capte excepciones solo para tirarlas de nuevo, y si * desea * atrapar y volver a lanzar, simplemente use 'throw;' en lugar de 'throw e ; '.) –