How to retrieve the sitename element value from the below xml?
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:63630/Service.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IService/GetDemographic</Action>
</s:Header>
<s:Body>
<GetDemographic xmlns="http://tempuri.org/">
<userIdentifier>first value</userIdentifier>
<sitename>second value</sitename>
<demographicName>third value</demographicName>
</GetDemographic>
</s:Body>
</s:Envelope>
The below code I tried returned null:
var xmlDocument = new XmlDocument();
xmlDocument.LoadXml(myXml);
var result = xmlDocument.SelectNodes("//sitename");
Is the problem the Xml Namespace? Could I search regardless of the namespace values as sitename element has no namespace assigned to it?
I found the below code which works fine:
xmlDocument.SelectNodes("//*[local-name()='sitename']");
How to make it case-insensitive?