I need to parse and read values from the following XML format:
<?xml version="1.0"?>
<Patients xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Person xmlns="http://ehr.org/VM/" NationalCode="1234" LastName="Morgan" FirstName="Alen">
</Person>
</Patients>
And I'm trying to read name of patients and birthday details using following code but for some reason xml.SelectNodes("/Patients/Person") is null, any idea how can I read the values from the xml?
XmlDocument xml = new XmlDocument();
xml.LoadXml(myXmlString);
XmlNodeList xnList = xml.SelectNodes("/Patients/Person");
foreach (XmlNode xn in xnList)
{
string firstName = xn["FirstName"].InnerText;
string lastName = xn["LastName"].InnerText;
}