Click here to Skip to main content
15,907,874 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello guys,

I am reading an XML Document and i want to check if a particular Element called PrescribedRegimenTypeCode is found in that xml Document if it find the Element then get it Value, i have tried the following

What I have tried:

C#
XDocument xd = XDocument.Load(@"D:\ConsoleApplication4\MyData.xml");  
  
string result2 = "";  
result2  = xd.Element("Container").Element("IndividualReport").Element("Condition").Element("Regimen").Element("PrescribedRegimenTypeCode").Value;  


I will appreciate any suggestions
Posted
Updated 24-Nov-16 21:54pm
Comments
Kornfeld Eliyahu Peter 24-Nov-16 15:50pm    
XPath

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900