diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index f19f05550dfb8db9d914b4bedccc2ae05d59381b..9155f0ecac2d32545bab14c3df6878643c637ff4 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -751,19 +751,25 @@ class SimpleSAML_Utilities {
 	 *
 	 * It will parse the string into a DOM document and validate this document against the schema.
 	 *
-	 * @param $xml     The XML string which should be validated.
+	 * @param $xml     The XML string or document which should be validated.
 	 * @param $schema  The schema which should be used.
 	 * @return Returns a string with the errors if validation fails. An empty string is
 	 *         returned if validation passes.
 	 */
-	public static function validateXML($message, $schema) {
-		assert('is_string($message)');
+	public static function validateXML($xml, $schema) {
+		assert('is_string($xml) || $xml instanceof DOMDocument');
 		assert('is_string($schema)');
 
 		SimpleSAML_XML_Errors::begin();
 
-		$dom = new DOMDocument;
-		$res = $dom->loadXML($message);
+		if($xml instanceof DOMDocument) {
+			$dom = $xml;
+			$res = TRUE;
+		} else {
+			$dom = new DOMDocument;
+			$res = $dom->loadXML($xml);
+		}
+
 		if($res) {
 
 			$config = SimpleSAML_Configuration::getInstance();