In addition to solution 1 by
Sergey Alexandrovich Kryukov[
^], i would like to provide sample (using
LinqToXml[
^]):
var result = xdoc.Descendants("hoststatus")
.Select(x=>new
{
hostid = (int)x.Element("host_id"),
statusUpdTime = (DateTime)x.Element("status_update_time"),
lastDownTime = (DateTime)x.Element("last_time_down"),
alias = (string)x.Element("alias"),
timeDiff = (TimeSpan)((DateTime)x.Element("status_update_time") - (DateTime)x.Element("last_time_down"))
});
result:
hostid statusUpdTime lastDownTime alias timeDiff
3132 2015-09-19 07:58:26 1970-01-01 02:00:00 ex Test Server 16697.05:58:26