如何选择多个 XML 标签作为 XElement,基于相同的属性进行过滤。 我有下面的代码,我想选择具有 action=true
的标签<root>
<first action="true">
<path>E:\Myfolder</path>
</first>
<second>
<path>C:\Users\</path>
</second>
<third action="true">
<name>Mytasks</name>
</third>
</root>
输出是这样的
<first action="true">
<path>E:\Myfolder</path>
</first>
<third action="true">
<name>Mytasks</name>
</third>
请大家帮帮我。我使用了 FirstorDefault() 但我只得到一条记录
最佳答案
试试这个。
$(path).find('root').find('[action="true"]')
关于c# - 如何通过属性值选择多个 XML 标记作为 XElement?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44698291/