I am having xml file with name as employeesInfo and in that the data is like
<?xml version="1.0" encoding="utf-8"?>
<EmployeeDetails>
<data>
<empCode>DIT-GINT-0001</empCode>
<FirstName>Dinesh</FirstName>
<LastName>Alla</LastName>
<Address>Guntur</Address>
</data>
<EmployeeDetails>
<empCode>DIT-GINT-0002</empCode>
<FirstName>Upendra</FirstName>
<LastName>Maddi</LastName>
<Address>guntur</Address>
</EmployeeDetails>
<EmployeeDetails>
<empCode>DIT-GINT-0003</empCode>
<FirstName>Chandrkanth</FirstName>
<LastName>Beth</LastName>
<Address>guntur</Address>
</EmployeeDetails>
</EmployeeDetails>
And My code to get attribute{"empCode"} value is
XDocument doc = XDocument.Load(System.Web.HttpContext.Current.Server.MapPath("~/employeesInfo.xml"));
XElement root = doc.Root;
string s = root.Elements("empCode").Last().ToString();
Requirement: I want to get empcode value of last parent element.
Example output of the above file: DIT-GINT-0003