Get value from xml element in c#

前端 未结 2 1254
误落风尘
误落风尘 2021-01-29 02:13

I am trying to get Absoluteentry tag\'s value from the below xml string, but its displaying objectrefrence not set exception

 
<         


        
2条回答
  •  北海茫月
    2021-01-29 02:53

    You can use Descendants too. Descendants finds children at any level.

    var result = doc.Element(env + "Envelope")
        .Element(env + "Body")
        .Descendants(responseNs + "Absoluteentry").Value;
    

提交回复
热议问题