Thanks Martin,
I ve tried your code but it still doesn't work for me ...
Here's the correct header of my xml file
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
soap:encodingStyle="http//schemas.xmlsoap.org/soap/encoding/">
<soap:Body>
<ProcessResponse xmlns="http://www.csc.com/graphtalk/">
<POGEST>
<ReturnStatus>
<BUSINESS_STATUS>WM_SUCCESS</BUSINESS_STATUS>
</ReturnStatus>
<Data>
...
</ProcessResponse>
</soap:Body>
</soap:Envelope>
So here's my code
XmlNamespaceManager nsmg = new XmlNamespaceManager(doc.NameTable);
nsmg.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope");
nsmg.AddNamespace("pr", "http://www.csc.com/graphtalk/");
XmlNodeList nodestatut =
doc.SelectNodes("soap:Envelope/soap:Body/pr:ProcessResponse", nsmg);
in fact, I need to get the this result
XmlNodeList nodestatut =
doc.SelectNodes("soap:Envelope/soap:Body/pr:ProcessResponse/pr:POGEST/pr:ReturnStatus",
nsmg);
Where 's the problem ? :-(
Stan
"Martin Honnen"
Use an XmlNamespaceManager and AddNamespace, assuming you have this
snippet of XML:
<soap:Envelope xmlns:soap="http://blabla">
<soap:Body>
<ProcessResponse xmlns="http://anotherblabla">
<myResult>
<data_1>1</data_1>
<data_2>2</data_2>
</myResult>
</ProcessResponse>
</soap:Body>
</soap:Envelope>
then you can use e.g.
XmlNamespaceManager namespaceManager = new
XmlNamespaceManager(xmlDocument.NameTable);
namespaceManager.AddNamespace("soap", "http://blabla");
namespaceManager.AddNamespace("pr", "http://anotherblabla");
XmlNodeList nodes =
xmlDocument.SelectNodes("soap:Envelope/soap:Body/pr:ProcessResponse/pr:myResult",
namespaceManager);
--