c# - how to extract maximum date from web page in dot net window application -
In my application, I want to remove the latest date shown in the web page. I am using the System.Xml.Linq.XDocument class to remove content. But I am not able to remove the feed's pubidate. Here is my code but the exception is.
System.Xml.Linq.XDocument feeddata = System.Xml.Linq.XDocument.Load ("http://feeds2.feedburner.com/plasticsnews/plasticsinformation/plastopedia"); Var maxPubDates = (Select feeds in feeddata.Descendants ("feeds") feeds; DateTime maxDate = maxPubDates.Max (feed => (date time) Feed Element ("pubadet"));
Actually the row:
var maxPubDates = (Select Feeds ("Feeds") feeds in Feeds.Descendants);
Nothing is returning, because the tag is not a lineage with "feeds"
Change it to this line and you will get the right result:
var maxPubDates = (choose items from feeddata.Descendants ("item") items);
Comments
Post a Comment