Reputation: 2686
I have this XML:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:re="http://purl.org/atompub/rank/1.0">
<title type="text">Recent Questions - Stack Overflow</title>
<link rel="self" href="http://stackoverflow.com/feeds" type="application/atom+xml" />
<link rel="alternate" href="http://stackoverflow.com/questions" type="text/html" />
<subtitle>most recent 30 from stackoverflow.com</subtitle>
<updated>2011-04-28T13:53:52Z</updated>
<id>http://stackoverflow.com/feeds</id>
<creativeCommons:license>http://www.creativecommons.org/licenses/by-nc/2.5/rdf</creativeCommons:license>
<entry>
<id>http://stackoverflow.com/questions/5819742/how-do-i-run-a-slow-running-batch-asynchronously-specifically-a-svn-post-commit</id>
<re:rank scheme="http://stackoverflow.com">0</re:rank>
<title type="text">How do I run a slow running batch Asynchronously, specifically a SVN post-commit?</title>
<category scheme="http://stackoverflow.com/feeds/tags" term="windows"/><category scheme="http://stackoverflow.com/feeds/tags" term="svn"/><category scheme="http://stackoverflow.com/feeds/tags" term="batch"/><category scheme="http://stackoverflow.com/feeds/tags" term="post-commit"/>
<author>
<name>digiguru</name>
<uri>http://stackoverflow.com/users/5055</uri>
</author>
<link rel="alternate" href="http://stackoverflow.com/questions/5819742/how-do-i-run-a-slow-running-batch-asynchronously-specifically-a-svn-post-commit" />
<published>2011-04-28T13:53:48Z</published>
<updated>2011-04-28T13:53:48Z</updated>
<summary type="html">
whatever1
</summary>
</entry>
<entry>
<id>http://stackoverflow.com/questions/5818592/wxpython-making-a-panel-not-accessible-through-tab</id>
<re:rank scheme="http://stackoverflow.com">0</re:rank>
<title type="text">wxPython making a panel not accessible through tab</title>
<category scheme="http://stackoverflow.com/feeds/tags" term="wxpython"/><category scheme="http://stackoverflow.com/feeds/tags" term="wxglade"/>
<author>
<name>ccwhite1</name>
<uri>http://stackoverflow.com/users/588892</uri>
</author>
<link rel="alternate" href="http://stackoverflow.com/questions/5818592/wxpython-making-a-panel-not-accessible-through-tab" />
<published>2011-04-28T12:30:02Z</published>
<updated>2011-04-28T13:53:34Z</updated>
<summary type="html">
whatever 2
</summary>
</entry>
</feed>
is a portion of the RSS from recents feeds from StackOverflow.
I need to get the entire xml back (I'm using Linq to XML.), but with only the entrys with a "updated" atribute with a value lower or equal to a DateTime passed by parameter.
I get the xml this way:
XDocument recientes = XDocument.Load(ObtenerFeedsRecientes());
recientes = recientes.Root.Elements().DontKnowWhatToDo();
Can someone give me an aproach in how to do this ?
Thank you!
Upvotes: 2
Views: 172
Reputation: 11592
XDocument recientes = XDocument.Load(ObtenerFeedsRecientes());
XNamespace atomNS = "http://www.w3.org/2005/Atom";
var updates = from entry in recientes.Root.Elements(atomNS + "entry")
where DateTime.Parse(entry.Element(atomNS + "updated").Value) <= parameter
select entry;
Should do the trick. This assumes parameter
is of the type DateTime
Upvotes: 3