使用 Descendatns 的 LINQ To XML 查询
我想使用 LINQ To XML 查询以下 xml 文件,
<table>
<row>
<cell>
<content>x</content>
<cell>
<cell>
<content>y</content>
<cell>
<cell>
<foo>
<bar>x</bar>
</foo>
<cell>
<row>
</table>
我试图获取所有具有值为“x”的后代的单元格节点。在此示例中,应返回两个单元节点
I want to query the following xml file using LINQ To XML
<table>
<row>
<cell>
<content>x</content>
<cell>
<cell>
<content>y</content>
<cell>
<cell>
<foo>
<bar>x</bar>
</foo>
<cell>
<row>
</table>
Im trying to get all cell nodes that have a descendant with the value 'x'. In this example two cell nodes should be returned
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
Any
扩展方法来查看单元格的任何后代是否具有正确的值。You can use the
Any
extension method to see if any of the descendents of cell have the correct value.