You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: I have experienced this issue using htmlquery, but it seems to not be fixed here either, so I am raising issue here.
By xpath spec, /descendant::span[1] and //span[1] are not the same.
/descendant::span[1] should get the first span descendant matched within the current ancestor, while //span[1] should get the first span descendant matched within the parent of each respective span element. This package seems to currently be treating both like //span[1]
In this case, //div[@id='wrapper']//span[1] should be matching both span one and span two, because both are the first child of their respective parents. However, //div[@id='wrapper']/descendant::span[1] should only match span one, as it goes by the position within div[@id='wrapper'], not position within direct parent.
See xpath spec 2.5
NOTE: The location path //para[1] does not mean the same as the location path /descendant::para[1]. The latter selects the first descendant para element; the former selects all descendant para elements that are the first para children of their parents.
The text was updated successfully, but these errors were encountered:
If I here run a queryall on //div[@id='wrapper']/a/following-sibling::div[1], I expected that both div 1 and div 2 are returned, as there are two matching anchors, both with their own first following sibling. However, only one match (div 1) seems to be returned.
However, I am not entirely sure if this is even an issue, as in initial checking I did not see this as clearly spelled out in the xpath spec as the main issue (though I did not read through it very thoroughly either). All I know is that the way I expected it to work is how the chromium devtools xpath implementation works.
Note: I have experienced this issue using htmlquery, but it seems to not be fixed here either, so I am raising issue here.
By xpath spec, /descendant::span[1] and //span[1] are not the same.
/descendant::span[1] should get the first span descendant matched within the current ancestor, while //span[1] should get the first span descendant matched within the parent of each respective span element. This package seems to currently be treating both like //span[1]
Example:
In this case,
//div[@id='wrapper']//span[1]
should be matching both span one and span two, because both are the first child of their respective parents. However,//div[@id='wrapper']/descendant::span[1]
should only match span one, as it goes by the position withindiv[@id='wrapper']
, not position within direct parent.See xpath spec 2.5
The text was updated successfully, but these errors were encountered: