I'm pretty new at using XML but i'm trying ;-) I want to in 2 different foreach loops get data from xml below:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<data>
  <players>
    <player id="1">0</player>
    <player id="2">0</player>
  </players>
  <chats>
    <chat playerid="2">Some chat here...</chat>
  </chats>
</data>
I want to get the 2 players out in one foreach loop and get the chats in another and I want also to get the attributes?

I have tried this but with no luck
PHP Code:
foreach($xml->children() as $players){
    echo 
$players->player;
    
// Not sure how to get the attribute?
    
echo "<br />";
}

foreach(
$xml->xpath('//chats') as $chat){
  echo 
$chat"<br />";

None of these examples gives any results? Please help...

Thanks in advance :-)