I am getting 0 count result when i am converting XML to string array using XDcoument object to string array as per below
Stream dataStream = response.GetResponseStream();
XDocument doc = XDocument.Load((dataStream));
var services = from s in doc.Descendants("Location")
select (string)s.Element("Name");
string[] locationArray = services.ToArray();
doc is as per below
<Locations xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Location>
<Name>Anywhere US</Name>
</Location>
<Location>
<Name>South Central US</Name>
</Location>
<Location>
<Name>Anywhere Europe</Name>
</Location>
<Location>
<Name>West Europe</Name>
</Location>
<Location>
<Name>Anywhere Asia</Name>
</Location>
<Location>
<Name>Southeast Asia</Name>
</Location>
<Location>
<Name>East Asia</Name>
</Location>
<Location>
<Name>North Central US</Name>
</Location>
<Location>
<Name>North Europe</Name>
</Location>
</Locations>
What should be wrong with the code to fetch array of location Name?
An interesting problem this was.
Because of your
xmlnsnamespace, the element names all have that namespace. This works:locationsnow contains all your locationsTo make it more readable you could do this: