
 No hay problema, mira puedes usar también este ejemplo del manual  
http://www.php.net/manual/en/book.simplexml.php#105998 
me funcionó también.    
Código PHP:
Ver original<?php
class Obj2xml
{
    public $xmlResult;
    
    function __construct($rootNode) {
        $this->xmlResult = new SimpleXMLElement("<$rootNode></$rootNode>");
    }
    
    private function iteratechildren($object, $xml) {
        foreach ($object as $name => $value) {
                $xml->$name = $value;
            } else {
                $xml->$name = null;
                $this->iteratechildren($value, $xml->$name);
            }
        }
    }
    
    function toXml($object) {
        $this->iteratechildren($object, $this->xmlResult);
        return $this->xmlResult->asXML();
    }
}
 
require ('xbox.php');
$xbox = new XboxGamercard();
$xbox->setGamertag('malatos');
$xbox->setRegion('en-GB');
$data = $xbox->fetchData();
 
$converter = new Obj2xml("API");
 
header("Content-Type:text/xml");  
echo $converter->toXml($data);