Linq to XML selecting a node bases on a attribute value

前端 未结 3 1203
情书的邮戳
情书的邮戳 2021-01-04 12:16

I have an xml file that returns a set of elements that are unique by a attribute value. This presents a problem, as I can not select a node by its name:

<         


        
3条回答
  •  忘掉有多难
    2021-01-04 12:29

    Use XElement like this:

    from rt in results.descendants("")
    where rt.attribute(attribute name).value == "specified value"
    select rt
    

    Sorry for typing from cell phone

提交回复
热议问题