How to get Xml Inner node value using c#
<?xml version="1.0"?>
<Document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdtc="urn:hl7-org:sdtc">
<docTime value="19981001064138-0400"/>
</Document>
Name space: xmlns="urn:hl7-org:v3"
Node: DocTime
C# code:
XDocument doc = XDocument.Parse(xmlData);
var docTime = doc.Descendants(XName.Get("{urn:hl7-org:v3}docTime")).FirstOrDefault().FirstAttribute.Value;
result of docTime: 19981001064138-0400
No comments:
Post a Comment