【问题标题】:Select HTML tag with multiple values in the same attribute选择同一属性中具有多个值的 HTML 标记
【发布时间】:2013-08-06 18:55:46
【问题描述】:

我正在使用 HtmlAgilityPack,但在搜索同一属性中具有多个值的节点时遇到了一些麻烦。例如:

<span class="test1 test2 test3">blah</span>

如果我尝试做这样的事情:

SelectSingleNode (.... [@class='test1']

它不起作用,只有当我一起搜索所有类时:

SelectSingleNode (.... [@class='test1 test2 test3']

有什么办法可以解决这个问题?

提前致谢!

【问题讨论】:

    标签: c# html-agility-pack


    【解决方案1】:

    完成!

    我可以使用这样的东西:

    SelectSingleNode("//span[contains(@class, 'test1')]");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多