我有以下 SOAP 响应:
<?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
现在,我能够使用以下代码获取所有销售元素:
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);
那么我如何在迭代销售元素时,选择它们的内在孩子,如 saleid 和 campaignid?我只是无法选择它们