Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

HELP! Using Dynamic LINQ with XML...

$
0
0

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.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>