Consider this simple example
library(xml2)
x <- read_xml("<body>
<p>Some <b>text</b>.</p>
<p>Some <b>other</b> <b>text</b>.</p>
<p>No bold here!</p>
</body>")
Now, I want to find all the parents of the nodes containing the string other
To do so, I run
> xml_find_all(x, "//b[contains(.,'other')]//parent::*")
{xml_nodeset (2)}
[1] <p>Some <b>other</b> <b>text</b>.</p>
[2] <b>other</b>
I do not understand why I also get the <b>other</b>
element as well. In my view there is only one parent, which is the first node.
Is this a bug?