在命名空间中获取属性的值

我正在尝试处理以下XML:

 Nombre SI SI   

我正在使用下一个代码:

 XDocument doc = XDocument.Parse(result); var q = from item in doc.Descendants() let attributeType = item.Attribute("AgenteRetencionIVA").Value select item; 

我有问题得到属性rif:AgenteRetencionIVA 。 我该怎么办?

貌似tou需要指定自定义命名空间:

 string xml = @"..."; XName nameRif = "rif"; XDocument doc = XDocument.Parse(xml); var q = from item in doc.Descendants() let attributeType = item.Attribute(nameRif + "AgenteRetencionIVA") select item.Value; var a = q.ToArray();