I have the following xml file:
<?xml version="1.0" encoding="utf-8"?>
<Cus>
<Customer Location="NJ">
<Male Value="True" />
<Name Value="xxx" />
</Customer>
<Customer Location="NY">
<Male Value="True" />
<Name Value="yyy" />
</Customer>
</Cus>
I am trying to query using the linq to xml inorder to get the value of male based on the customer location.
Here is the query:
var Male = from e in doc.Descendants("Male")
select new
{
Male = e.Attribute("Value").Value.ToString()
};
I am able to get the value of the male but i am confused how to get the name based on the location of the customer in the xml file.How to add a where condition in here which determines the location of the customer.I would appreciate if some one can guide me.