HELP! Using Dynamic LINQ with XML...

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
i am trying to use dynamic LINQ to query an XML document, as indicated is possible on Scott Guthries 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)";<br/>
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.

View the full article
 
Back
Top