how to remove namespace from an xml

chrispaton
chrispaton used Ask the Experts™
on
i have an xml that's loaded from a webservice response.The problem is the xmlns namespace.i'm having problems navigating past it.I am using XmlNamespaceManager to get past the soap envelope and body but when i try and go further it keeps adding the <GetResponse xmlns="http://www.com/webservice"> namespace.Is there a way to remove this.Here is code
doc.Load(res.GetResponseStream());
       
        String xmlstr = doc.InnerXml;

        XmlNamespaceManager nMan = new XmlNamespaceManager(doc.NameTable);
        nMan.AddNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/");
        nMan.AddNamespace("g", "http://www.com/webservice");
        XmlNode xNode = doc.SelectSingleNode("s:Envelope/s:Body/*", nMan);
        string value = xNode.InnerXml;

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetResponse xmlns="http://www.com/webservice">
  <GetResult>
  <ReturnCode>true</ReturnCode>
  <WebServiceErrors />
  <Code>*******</Code>
 <Extras>
 <Extra>
  <CreationDate>0001-01-01</CreationDate>
  <Currency>GBP</Currency>
  <EndDate>2010-07-31</EndDate>
  <Amount>17</Amount>
  <CCode>BG</CCode>
  <Description>Included in the price</Description>
  <Num>0</Num>
  <Txt>BG</Txt>
  <Type>fee</Type>
  <StartDate>2010-07-24</StartDate>
 </Extra>
 <Extras>
  <Extra>
  <CreationDate>0001-01-01</CreationDate>
  <Currency>GBP</Currency>
  <EndDate>2010-07-31</EndDate>
  <Amount>20</Amount>
  <CCode>BG</CCode>
  <Description>Included</Description>
  <Num>0</Num>
  <Txt>BG</Txt>
  <Type>fee</Type>
  <StartDate>2010-07-24</StartDate>
 </Extra>
 </Extras>
  </GetResult>
</GetResponse>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial