Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这更像是一个 XPath 问题,但我如何告诉 getNodeSet 只接受 1 个类的类匹配?
例如,我可能有
<tr class="cool coolio">
如果我这样做
getNodeSet(root, "tr[@class="cool"])
我将无法捕捉到上面的标签,我需要完全限定它
getNodeSet(root, "tr[@class="cool coolio"])
有什么方法可以捕获上述标签而不必指定两个可能的类?
是的,你应该能够做到这一点:
getNodeSet(root, "tr[contains(concat(' ', @class, ' '), ' cool ')]")