如何结合两个节点集合? [英] How can I combine two nodecollection?
本文介绍了如何结合两个节点集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道了
var x = document.DocumentNode.SelectNodes("*//tr[@class='even']")
var y = document.DocumentNode.SelectNodes("*//tr[@class='odd']")
如何合并这些html节点集合?
How can I combine these html node collections?
要尝试x.Concat(y).ToList()
推荐答案
另一个选择是使用XPath方法.您可以使用XPath联合(|
)组合两个查询:
Another option is using XPath approach. You can use XPath union (|
) to combine two queries :
var xy = document.DocumentNode
.SelectNodes("*//tr[@class='even'] | *//tr[@class='odd']");
这篇关于如何结合两个节点集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文