Extract specific xml node



Good day,


I am trying to accomplish something using an xml file but keep failing due to the fact that I am not very experienced handling xml files. I have the following xml file which has this:



<XmlSports xmlns:xsd="http://ift.tt/tphNwY" xmlns:xsi="http://ift.tt/ra1lAU" CreateDate="2014-11-17T14:46:38.6954+01:00">
<Sport Name="SOCCER" ID="7">
<Event Name="African Nations Cup" ID="54" IsLive="false">
<Match Name="DR Congo v Sierra Leone" ID="1552163" StartDate="2014-11-19T15:00:00.1+01:00">
<Bet Name="Double Chance" ID="6337125"/>
<Bet Name="Draw No Bet" ID="6337124"/>
<Bet Name="Match Odds" ID="6337119"/>
<Bet Name="Odds or Evens" ID="6337123"/>
<Bet Name="Over/Under" ID="6337121"/>
</Match>
</Event>
</Sport>


I am just including a small portion of the file but basically this file includes other sports aside from just soccer, separated by 'Sport Name="NAME OF SPORT" ID="ID OF SPORT"'.


What I am trying to accomplish is extracting just the SOCCER node. I have tried using xpath but have not succeeded. Can anyone please shed a light and tell me how to extract just the 'Sport Name="SOCCER" ID="7"' part out of this xml?


Thanks in advance!


No comments:

Post a Comment