I have this xml data
<Records>
<Person id="1234" action="chg" date="12-Oct-2000">
<Gender>Male</Gender>
<ActiveStatus>Active</ActiveStatus>
<Deceased>No</Deceased>
<NameDetails>
<Name NameType="Primary Name">
<NameValue>
<FirstName>Joe</FirstName>
<Surname>Doe</Surname>
<OriginalScriptName>Joe Doe</OriginalScriptName>
</NameValue>
</Name>
<Name NameType="Spelling Variation">
<NameValue>
<FirstName>John</FirstName>
<Surname>Doo</Surname>
</NameValue>
<NameValue>
<FirstName>Joeh</FirstName>
<Surname>Doeh</Surname>
</NameValue>
<NameValue>
<FirstName>Jay</FirstName>
<Surname>Doe</Surname>
</NameValue>
<NameValue>
<FirstName>Joo</FirstName>
<Surname>Doe</Surname>
</NameValue>
</Name>
</NameDetails>
</Person>
</Records>
I can select the value for Gender, ActiveStatus and Deceased with this code:
XmlNodeList xmlNodePersonList = xmlDocument.SelectNodes("/Records/Person");
var personProfileList = new List<PersonProfile>();
foreach (XmlNode childEllement in xmlNodePersonList)
{
var personProfile = new PersonProfile
{
Gender = childEllement["Gender"].InnerText,
ActiveStatus = childEllement["ActiveStatus"].InnerText,
Deceased = childEllement["Deceased"].InnerText
};
personProfileList.Add(personProfile);
}
But how do I select the value for NameDetails for that structure?