简体   繁体   中英

Partial Matching in R getNodeSet

This is more of a XPath question, but how do I tell getNodeSet to accept class matches on only 1 class?

For instance, I might have

<tr class="cool coolio">

and if I do

getNodeSet(root, "tr[@class="cool"])

I will not be able to catch the tag above, I need to fully qualify it with

getNodeSet(root, "tr[@class="cool coolio"])

Is there any way to catch the above tag without having to specify both possible classes?

是的,你应该能够做到这一点:

getNodeSet(root, "tr[contains(concat(' ', @class, ' '), ' cool ')]")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM