i am trying to use dynamic LINQ to query an XML document, as indicated is possible on Scott Guthrie's blog post here:
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
below is my code sample:
-----------
XElement pViewElement = XElement.Load(...);
string sFilter = @"Convert.ToInt32(Attribute("Age").Value) >= 60)";
List<XElement> pViewResults = pViewElement.Elements().AsQueryable().Where(sFilter).ToList();
-----------
however, when this code executes, i receive the following error:
"No applicable method 'Attribute' exists in type 'XElement'"
does anyone know why this is? obviously, that method DOES exist when i write the code normally. i cannot find an XML example with dynamic LINQ anywhere. rather, the only good examples are against a SQL backend.
your help is greatly appreciated in advance.