代码之家  ›  专栏  ›  技术社区  ›  Muhammad Akhtar

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

  •  1
  • Muhammad Akhtar  · 技术社区  · 16 年前

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

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

    SelectNodes("//td[@class=\"roomPrice figure\"]"); 有时候就像 SelectNodes("//td[@class=\"roomPrice figure bb\"]");

    两个班我都要 roomPrice figure 或者 roomPrice figure bb

    我怎样才能做到这一点。

    1 回复  |  直到 16 年前
        1
  •  2
  •   Rohit Agarwal    16 年前

    Xpath没有OR运算符。为您的选择查询尝试此操作-

    "//td[@class=\"roomPrice figure\" or @class=\"roomPrice figure bb\"]"
    
    推荐文章