Thanks for your help! 
I followed the link 
http://ru.php.net/manual/en/function.xml-parse.php looking for some examples
and I could represent the xml text using an object instead of an associative array which is the same for my purpose.
The class is xml_doc, found at 
 
I did something like this:
 	
	| $xml = new xml_doc(); 
 $root_tag = $xml->createTag('phonebook');
 
 $person=$xml->createTag('person',array(),'',$root_tag);
 $name_tag=$xml->createTag('name',array(),'jose',$person);
 $phone_tag=$xml->createTag('phone',array(),'73989028',$person);
 
 $person=$xml->createTag('person',array(),'',$root_tag);
 $name_tag=$xml->createTag('name',array(),'luis',$person);
 $phone_tag=$xml->createTag('phone',array(),'73982332',$person);
 
 $my_output = $xml->generate();
 
 print htmlspecialchars($my_output);
 |