2

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!

1 Answer 1

3
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

Sign up to request clarification or add additional context in comments.

1 Comment

i tested this aproach and it worked, didn't use it though, i created my own database with the information from the xml and use EntityFramework with LINQ to SQL! thanx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.