I'm consuming a recipe server and it returns me an XML like:
<retDistDFeInt xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" versao="1.01" xmlns="http://www.portalfiscal.inf.br/nfe">
<tpAmb>1</tpAmb>
<verAplic>1.1.9</verAplic>
<cStat>138</cStat>
<xMotivo>Documento(s) localizado(s)</xMotivo>
<dhResp>2018-10-09T13:01:42-03:00</dhResp>
<ultNSU>000000000000000</ultNSU>
<maxNSU>000000000000013</maxNSU>
<loteDistDFeInt>
<docZip NSU="000000000000001" schema="resNFe_v1.01.xsd">XYZABCdUKAAF...etc</docZip>
<docZip NSU="000000000000002" schema="resNFe_v1.01.xsd">XYZABCdUKAAF...ec</docZip>
</loteDistDFeInt>
</retDistDFeInt>
I've tried several ways to extract the values of the docZip tags from XML using XElement with Linq and it all returned empty.
Some codes I've tried:
var retorno = from nota in xmlRetorno.Elements("retDistDFeInt") select nota;
var retorno = from nota in xmlRetorno.Elements("loteDistDFeInt") select nota;
var points = xmlRetorno.Descendants("loteDistDFeInt");
var point = points.FirstOrDefault();
var retorno = from nota in xmlRetorno.Elements("loteDistDFeInt")
select new
{
nsu = (string)nota.Element("NSU"),
schema = (string)nota.Element("schema")
};