I have some XML like this:
<Team ...some attributes...> <Name>My Team</Name> <Player uID="player1"> <Name>Name</Name> <Position>Goalkeeper</Position> <Stat Type="first_name">Name</Stat> <Stat Type="last_name">Last</Stat> <Stat Type="birth_date">bday</Stat> <Stat Type="birth_place">bplace</Stat> <Stat Type="weight">84</Stat> <Stat Type="height">183</Stat> <Stat Type="jersey_num">1</Stat> </Player> <Player uID="player2"> ... </Player> ... </Team>
I want to search for players by
jersey_num. I'm using Nokogiri and this code gets me sort of close:
That returns all the players in a given team, and an array of their jersey number attribute rows, but I want to find a player with a given jersey number, and then pull its
I can do that with ancestor, but first I need this search to yield only one matching player. I realize at the moment I'm not searching for it, but I'm not sure how to search given the
Stat Type syntax.