代码之家  ›  专栏  ›  技术社区  ›  MicMit

匹配htmlagilityPack的多个属性的xpath表达式

  •  2
  • MicMit  · 技术社区  · 15 年前

    假设我想找到一个具有特定宽度和高度属性的表 没有问题

    doc.DocumentNode.SelectSingleNode("//table[@width='500']"); 
    

    是否可以将height='500'以某种方式添加到此xpath表达式中?

    1 回复  |  直到 15 年前
        1
  •  3
  •   mykhal    15 年前

    使用逻辑“和”运算符:

    doc.DocumentNode.SelectSingleNode("//table[@width='500' and @height='500']");