Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

how to remove namespace from an xml

Avatar of chrispaton
chrispaton asked on
XMLASP.NETWeb Services
2 Comments1 Solution537 ViewsLast Modified:
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>
ASKER CERTIFIED SOLUTION
Avatar of chrispaton
chrispaton

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers