php simplxml - Trying to get property of non-object in



So I'm getting an error trying to access player name in an XML File using the code. I'm not sure if i'm accessing the information right is there something I'm doing wrong?



<?php
$xml = simplexml_load_file('trueskill.bcn');

$playername = $xml->SK92->Players[0]->Name;

echo $playername;
?>


Using the XML File



<?xml version="1.0" encoding="utf-8"?>
<SK92>
<Settings Multiplier="200" Decay="0" />
<Players>
<Player Name="Mark" Team="" Invisible="false" Characters="" Alts="JFG;Mark;SEBA" />
<Player Name="Antonio" Team="" Invisible="false" Characters="" Alts="Proxy;Toni" />
</Players>
</SK92>

No comments:

Post a Comment