diff --git a/servers/rest_server/includes/RESTServer.inc b/servers/rest_server/includes/RESTServer.inc
index a456b76..46ea9dc 100755
--- a/servers/rest_server/includes/RESTServer.inc
+++ b/servers/rest_server/includes/RESTServer.inc
@@ -462,6 +462,74 @@ class RESTServer {
     return unserialize(self::contentFromStream($handle));
   }
 
+  public static function parseXML($handle) {
+	// get/hold the old error state
+    $old_error_state = libxml_use_internal_errors(1);
+
+	// clear all libxml errors
+    libxml_clear_errors();
+
+	// get a now SimpleXmlElement object from the XML string
+    $xml_data = simplexml_load_string(self::contentFromStream($handle));
+
+	// if $xml_data is Null then we expect errors
+    if (!$xml_data) {
+	  // build an error message string
+      $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";
+      }
+
+	  // clear all libxml errors and restore the old error state
+      libxml_clear_errors();
+      libxml_use_internal_errors($old_error_state);
+
+	  // throw an error
+      services_error($message, 406);
+    }
+	// whew, no errors, restore the old error state
+    libxml_use_internal_errors($old_error_state);
+
+	// unmarshal the SimpleXmlElement, and return the resulting array
+	$php_array = self::unmarshalXML($xml_data, NULL);
+    return (array) $php_array;
+  }
+
+  /**
+   * A recusive function that unmarshals an XML string, into a php array.
+   */
+  protected static function unmarshalXML($node, $array) {
+	// For all child XML elements
+	foreach ($node->children() as $child) {
+	  if (count($child->children()) > 0) {
+		// if the child has children
+		$att = 'is_array';
+		if ($child->attributes()->$att) {
+			$new_array = array();
+			// recursive through <item>
+			foreach($child->children() as $item){
+				$new_array[] = self::unmarshalXML($item, $array[$item->getName()]);
+			}
+		}
+		else {
+		  // else, simply create an array where the key is name of the element		
+		  $new_array = self::unmarshalXML($child, $array[$child->getName()]);
+		}
+		// add $new_array to $array
+		$array[$child->getName()] = $new_array;
+	  }
+	  else {
+		if ($child->attributes()->is_raw) {
+			return (string) $child;
+		}
+		$array[$child->getName()] = (string) $child;
+	  }
+	}
+	// return the resulting array
+	return $array;
+  }
+
   public static function parseJSON($handle) {
     return json_decode(self::contentFromStream($handle), TRUE);
   }
diff --git a/servers/rest_server/rest_server.module b/servers/rest_server/rest_server.module
index 6f23fac..ea9f1fe 100755
--- a/servers/rest_server/rest_server.module
+++ b/servers/rest_server/rest_server.module
@@ -52,6 +52,8 @@ function rest_server_request_parsers() {
       'application/json' => 'RESTServer::parseJSON',
       'application/vnd.php.serialized' => 'RESTServer::parsePHP',
       'multipart/form-data' => 'RESTServer::parseMultipart',
+      'application/xml' => 'RESTServer::parseXML',
+      'text/xml' => 'RESTServer::parseXML',
     );
 
     if (_rest_server_get_spyc_location() !== false) {
