--- a/servers/rest_server/includes/RESTServer.inc	2011-11-16 16:18:31.000000000 -0500
+++ b/servers/rest_server/includes/RESTServer.inc	2011-12-16 15:53:12.207521415 -0500
@@ -469,6 +469,47 @@
     return unserialize(self::contentFromStream($handle));
   }
 
+  public static function parseXML($handle) {
+    $old_error_state = libxml_use_internal_errors(1);
+    libxml_clear_errors();
+    $xml_data = simplexml_load_string(self::contentFromStream($handle));
+	watchdog("RestServer_debug", print_r($xml_data. TRUE));
+
+    if (!$xml_data) {
+      $message = '';
+      $errors = libxml_get_errors();
+      foreach ($errors as $error) {
+        $message .= t('Line @line, Col @column: @message', array('@line' => $error->line, '@column' => $error->column, '@message' => $error->message)) . "\n\n";
+      }
+      libxml_clear_errors();
+      libxml_use_internal_errors($old_error_state);
+      services_error($message, 406);
+    }
+    libxml_use_internal_errors($old_error_state);
+
+	$php_array = self::unmarshalXML($xml_data, NULL);
+    return (array) $php_array;
+  }
+
+  private static function unmarshalXML($node, $array) {
+	foreach ($node->children() as $child) {
+	  if (count($child->children()) > 0) {
+		$att = 'is_array';
+
+		if ($child->attributes()->$att) {
+		  $new_array = array();
+		  $new_array[0] = self::unmarshalXML($child, $array[$child->getName()]);
+		} else {
+		  $new_array = self::unmarshalXML($child, $array[$child->getName()]);
+		}
+		$array[$child->getName()] = $new_array;
+	  } else {
+		$array[$child->getName()] = (string) $child;
+	  }
+	}
+	return $array;
+  }
+
   public static function parseJSON($handle) {
     return json_decode(self::contentFromStream($handle), TRUE);
   }
