1

我可以使用 HTMLAgility 将 OR 子句放在节点选择中吗

(HtmlAgilityPack.HtmlNodeCollection)doc.DocumentNode.SelectNodes("//td[@class=\"roomPrice figure\"]");

我需要的是有时它应该像SelectNodes("//td[@class=\"roomPrice figure\"]"); 有时它像SelectNodes("//td[@class=\"roomPrice figure bb\"]");

我需要同时获得两个课程roomPrice figureroomPrice figure bb

我怎样才能做到这一点。

谢谢你的帮助

4

1 回答 1

2

Xpath 确实有一个 OR 运算符。试试这个作为您的选择查询 -

"//td[@class=\"roomPrice figure\" or @class=\"roomPrice figure bb\"]"
于 2010-06-27T23:32:16.080 回答