I call a wcf service like this:
XDocument xdoc = null;
xdoc = XDocument.Load("http:\\www.mydomain.com\service\helloservice");
I receive a xml snippet from WCF like the below:
<ArrayOfstring><string>hello</string><string>world</string><string>!</string></ArrayOfstring>
I am trying to get the content within the elements
my code is like this but I never get anything back:
var i = (from n in xdoc.Descendants("string")
select new { text = n.Value});
when I do xdoc.DescendantNodes() I get:
[0] "<ArrayOfstring xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<string>HELLO</string>
</ArrayOfstring>"
[1] "<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">HELLO</string>"
[2] "Hello"
I am pretty new to this, I can’t figure out why linq won’t return results…Which Xdocument feature should I use? Some pointer would be appreciated. Thanks.
UPDATE