Index: HttpClientXMLFormatter.inc
===================================================================
--- HttpClientXMLFormatter.inc	(revision 2050)
+++ HttpClientXMLFormatter.inc	(revision 2052)
@@ -11,6 +11,9 @@
   /**
    * Serializes arbitrary data to the implemented format.
    * Directly stolen from http_server by Hugo Wetterberg
+   * 
+   * If $data is an array of the type array($key => $value), and $key is
+   * non-numeric
    *
    * @param mixed $data
    *  The data that should be serialized.
@@ -19,7 +22,16 @@
    */
   public function serialize($data) {
     $doc = new DOMDocument('1.0', 'utf-8');
-    $root = $doc->createElement('result');
+    $root_tag = 'result';
+    
+    if (is_array($data) && (count($data) == 1) && !is_numeric(key($data))) {
+      $key = key($data);
+      $key = preg_replace('/[^A-Za-z0-9_]/', '_', $key);
+      $root_tag = preg_replace('/^([0-9]+)/', '_$1', $key);
+      $data = current($data);
+    }
+    
+    $root = $doc->createElement($root_tag);
     $doc->appendChild($root);
 
     $this->xml_recurse($doc, $root, $data);
