Allora ho un file xml : utenti.xml strutturato cosi

<?xml version="1.0" encoding="iso-8859-1"?>
<Users>
<user id="1" username="Nome" password="pass">
// altri tag che ometto
</user>
</Users>

Ora dovrei effetturare la login e provo con questo codice
<?php
Codice PHP:
$file_utenti "../data/utenti.xml";

//$username=$_POST["username"];
//$password=$_POST["password"];

$username="nome";
$password="pass";

$resultfalse;
$structure = array();

if (
file_exists($file_utenti)) {
    
// trasformiamo l'XML utenti in array
$structure xml_to_array($file_utenti);
    
// cerchiamo l'user e password passate
    
$result find_user($username$password$structure);

    if (
$result) {
        echo 
"&response=true";
    } else {
        echo 
"&response=false";
    }

} else {
    exit(
"Failed to open '$file_utenti'.");
}

function 
find_user($username$password$struct) {
    
$i 0;
    foreach (
$struct['children'] as $user) {
        if (
$user['attributes']['username'] == $username) {
            if (
$user['attributes']['password'] == $password) {
                return 
true;
            }
        }
    }
    return 
false;
}

function 
xml_to_array$file )
{
    
$parser xml_parser_create();
    
xml_parser_set_option$parserXML_OPTION_CASE_FOLDING);
    
xml_parser_set_option$parserXML_OPTION_SKIP_WHITE);
    
xml_parse_into_struct$parserfile_get_contents($file), $tags );
    
xml_parser_free$parser );

    
$elements = array();
    
$stack = array();

    foreach ( 
$tags as $tag )
    {
        
$index count$elements );
        if ( 
$tag['type'] == "complete" || $tag['type'] == "open" )
        {
            
$elements[$index] = array();
            
$elements[$index]['name'] = $tag['tag'];
            
$elements[$index]['attributes'] = $tag['attributes'];
            
$elements[$index]['content'] = $tag['value'];

            if ( 
$tag['type'] == "open" )
            {
                
# push
                
$elements[$index]['children'] = array();
                
$stack[count($stack)] = &$elements;
                
$elements = &$elements[$index]['children'];
            }
        }

        if ( 
$tag['type'] == "close" )
        {
            
# pop
            
$elements = &$stack[count($stack) - 1];
            unset(
$stack[count($stack) - 1]);
        }
    }
    return 
$elements[0];
}
?> 
Ho PHP 4.3.10 istallato con EasyPhp..

mi da questo errore

Notice: Undefined index: attributes in c:\programmi\easyphp1-8\www\dev\php\login.php on line 59

la linea 59 è $elements[$index]['attributes'] = $tag['attributes'];

non capisco perchè