I have the following SOAP response:
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<GetSalesResponse xmlns="http://api.dgm-uk.com/Publisher/schemas">
<status>ok</status>
-<sales>
-<sale>
<saleid>***</saleid>
<campaignname>***</campaignname>
<campaignid>***</campaignid>
<advertisername>***</advertisername>
</sale>
-<sale>
<saleid>***</saleid>
<campaignname>***</campaignname>
<campaignid>***</campaignid>
<advertisername>***</advertisername>
</sale>
..............etc
Now, I was able to get all the sale elements using this code:
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlFile.NameTable);
nsmgr.AddNamespace("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
nsmgr.AddNamespace("GSR", "http://api.dgm-uk.com/Publisher/schemas");
var items = xmlFile.DocumentElement.SelectSingleNode("/soapenv:Envelope/soapenv:Body/GSR:GetSalesResponse/GSR:sales", nsmgr);
How can I then while iterating the sale elements, select their inner children like saleid and campaignid? I just can’t select them
This works…