在节点选择标准中添加OR子句 - HTMLAgility

时间:2010-06-27 19:11:04

标签: asp.net html-agility-pack selectnodes

我可以使用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

我怎样才能做到这一点。

感谢您的帮助

1 个答案:

答案 0 :(得分:2)

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

"//td[@class=\"roomPrice figure\" or @class=\"roomPrice figure bb\"]"