<p>I am trying to get some XML data with LINQ, but running into a problem.</p>

<p>I am using a schema, which is set in the attribute xmlns ...</p>

<pre><code>&lt;CarsForSale xmlns="http://schemas.sharplogic.net/CarSales.xsd"&gt;
  &lt;CarForSale&gt;
</code></pre>

<p>There are many CarForSale elements.</p>

<p>When the schema is set and I do this...</p>

<pre><code>XElement doc = XElement.Load(HttpContext.Current.Server.MapPath("App_Data/XML/CarsForSale.xml"));

var cars2 = from d in doc.Descendants("CarForSale")
            select d;
</code></pre>

<p>Then I get in the results i get Enumeration yielded no results </p>

<p>Strip the xmlns out of the XML file and the data comes back as expected??</p>

<p>Any ideas?</p>

<p>Thx</p>

You need to prepend the namespace:
```
```
var ns    = "http://schemas.sharplogic.net/CarSales.xsd";
var cars2 = from d in doc.Descendants(ns + "CarForSale")            
            select d;
```
```
otherwise search by local name:
```
```
var cars2 = from d in doc.Descendants()
            where d.Name.LocalName == "CarForSale"            
            select d;
```
```