I am trying to get some XML data with LINQ, but ran into a problem.
I am using a schema that is set in the xmlns attribute ...
<CarsForSale xmlns="http://schemas.sharplogic.net/CarSales.xsd"> <CarForSale>
There are many CarForSale elements.
When the circuit is installed, and I do it ...
XElement doc = XElement.Load(HttpContext.Current.Server.MapPath("App_Data/XML/CarsForSale.xml")); var cars2 = from d in doc.Descendants("CarForSale") select d;
Then I get the results that get Enumeration, and give no results
Extract the xmlns from the XML file and the data will return as expected.
Any ideas?
thanks
source share