parent

p

span

h2

h3

p

p class "1"

p

span class "2" span also class "2" span

h3 class "3"

h5

In this example, we return all elements with class names "1", "2" and "3", that are the next sibling elements between h2 and h5.