problem with parsing XML for Values

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im attempting to parse through a string for the Results of a SOAP call..
String _responseString = mailto:“@<?xml â@<?xml version="1.0" encoding="utf-8"?><br/>
<soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/ "
<br/>
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance "
<br/>
xmlns:xsd=" http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema <br/>
<soap:Body><br/>
<Responses xmlns=" http://webservices.local.com/ http://webservices.local.com/ <br/>
<Results>5,mySecond_island,5,myFirst_island,1,fifth_island,1,fourth_island</Results><br/>
</Responses><br/>
</soap:Body><br/>
</soap:Envelope>â;
<br/>
string nspace = " http://webservices.local.com/ http://webservices.local.com/ ";<br/>
XDocument doc = XDocument.Parse(_responseString);<br/>
var body = doc.Descendants(XName.Get("Body", nspace)).FirstOrDefault();
var query = from node in body.Descendants(XName.Get("Responses", nspace)) <br/>
select new { query = node.Element("Results").Value };
the error is a NullReferenceException
Any suggestions are appreciated.
Cheers,

View the full article
 
Back
Top