I have the following complex, not quite well-structured XML:
<event hometeam="K.Kanepi" awayteam="S.Lisicki" eventName="K.Kanepi-S.Lisicki" date="02/07/2013" time="14:05" datetime="2013-07-02T14:05:00+02:00">
<subevent title="Match odds" dsymbol="MATCH_ODDS">
<selection name="home" odds="3.1500" slipURL="URI/en/add-bet/3187-02072013,1"/>
<selection name="away" odds="1.3500" slipURL="URI/en/add-bet/3187-02072013,2"/>
</subevent>
I'm trying to parse it using this code:
$total_games = $xml->event->count();
for ($i = 0; $i < $total_games; $i++) {
echo $xml->event[$i]->subevent.title;
$total games works correctly; however - when I try to parse subevent, I'm unsuccessful in getting the eventName, hometeam, date, etc.