<?xml version="1.0" encoding="UTF-8" ?>
<Accounts>
<Account id="usama" password="3210" lastUpdated="6/16/2011 11:21:59 AM" nextUpdate="6/16/2011 11:36:59 AM">
<SubAccount id="false">
<Url>yahoo</Url>
<Review>not so good</Review>
</SubAccount>
<SubAccount id="false">
<Url>google</Url>
<Review>as good as heard.</Review>
</SubAccount>
</Account>
</Accounts>
Suppose I want to get all those results whose last updated date is less than or equal to today (suppose 6/17/2011).
So my result should look like this.
Accout id =usama ,passwod =3210 ,url=yahoo, review=not so good
Accout id =usama ,passwod =3210 ,url=google, review=as good as heard
I wrote a request so far
var q = from c in doc.Descendants("Accounts")
from a in c.Descendants("Account")
where a.Attribute("nextUpdate").Value == "6/16/2011 11:36:59 AM"
select new
{
accountName = a.Attribute("id").Value,
password = a.Attribute("password").Value,
url = a.Descendants("SubAccount").Descendants("Url").ToString()
}
I get the username and password in order, but I don't know how to get the url and view. Also, how to discard the attribute ("nextUpdate") in the place where there is time to date so that I can compare it with the date?
source
share