Saturday, 18 October 2014

Where command, XML Feed Windows phone 8



I can get the following feed to work without the where command, when I put the where command in I am not able to get it to work.


The 1231 is the value that routeId can be and is the value that routeId will be when it gets to the select command.


Any reason why this is failing?


Have also tried:



where s.Element("routeId").Value.Contains("1231")


And



where s.Attribute("routeId").Value == "1231"


and



where s.Element("routeId").Value == ("1231")


current code:



var routeNames = (from n in doc.Descendants(ns + "Service")
select new RootContainer
{
Service = (from s in n.Element(ns + "routes").Elements(ns + "Route")
// where (n.Elements(ns + "timetables").Elements(ns + "Timetable").Elements(ns + "daysOfWeek").ToString() == "Sundays and Public Holidays from 14 September")
where s.Element("routeId").Value == "1231"
select new Services

{
RouteName = s.Element(ns + "routeName").Value,
RouteId = s.Element(ns + "routeId").Value,
// Routes = s.Element(ns + "routeId").Attribute("1231").Value


// TimetableName = s.Element(ns + "timetables").Element(ns + "Timetable").Element(ns + "daysOfWeek").Value,


}).ToList()

}).First();

No comments:

Post a Comment