Your comments suggest that you want to find the second element child of some node, but your code is actually finding the second node child instead. You forgot to take into account all those whitespace text nodes that are separating your tags.