LINQ to XML returns no result

M@f1a

New Member
I am using Linq to to parse an XML, but it return no result:XML:\[code\]<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <downloadInfoResponse xmlns="http://webService"> <downloadInfoReturn> <city>city</city> <companyName>company name</companyName> </downloadInfoReturn> </downloadInfoResponse> </soapenv:Body></soapenv:Envelope>\[/code\]Code:\[code\]public class Merc{ public string CompanyName { get; set; }}using (XmlReader reader = XmlReader.Create(new StringReader(result))){ XDocument doc = XDocument.Load(reader, LoadOptions.SetLineInfo); List<Merc> m = (from downloadInfoReturn in doc.Descendants("downloadInfoReturn") select new Merc { CompanyName = downloadMerchantInfoReturn.Element("companyName").Value }).ToList();}\[/code\]Is there any other good method to do it? Thank you.
 
Back
Top