Separate function for getting xml node by index