Hi My Code Masters,
Trust you all are doing just fine.
Please I want to get the Values of this Element <PrescribedRegimenTypeCode>ART</PrescribedRegimenTypeCode> from my XML files if the vale is ART i will then count Regimen else i will not. so i use this code
- int RegimenCounter = 0;
- string result = "";
- if(!string.IsNullOrEmpty(result=xd.Descendants("PrescribedRegimenTypeCode").Single().Value))
- {
- if (result == "ART")
- {
- RegimenCounter = xd.Descendants("Regimen").Count();
- }
- }
when i execute the code i am getting an exception error "Sequence Contain no Element". it because the first XML file does not contain that Element "PrescribedRegimenTypeCode" while other files have in them.
please i need your help to resolve this challenge.
thank you