]> git.mjollnir.org Git - moodle.git/commitdiff
Only validate against schema if we have a schema. ;-)
authorstronk7 <stronk7>
Sat, 24 Feb 2007 00:05:05 +0000 (00:05 +0000)
committerstronk7 <stronk7>
Sat, 24 Feb 2007 00:05:05 +0000 (00:05 +0000)
Merged from MOODLE_18_STABLE

lib/xmldb/classes/XMLDBFile.class.php

index b39c8c7fbdadfebc98bf97a18c14ba3248734afd..6e5dfdc5db12f2849f5fc34c684f11245b7b3533 100644 (file)
@@ -80,10 +80,14 @@ class XMLDBFile extends XMLDBObject {
         /// Create and load XML file
             $parser = new DOMDocument();
             $parser->load($this->path);
-        /// Validate XML file against schema
-            if (!$parser->schemaValidate($this->schema)) {
-            /// Get errors
-                $errors = libxml_get_errors();
+        /// Only validate if we have a schema
+            if (!empty($this->schema) && file_exists($this->schema)) {
+                $parser->schemaValidate($this->schema);
+            }
+        /// Check for errors
+            $errors = libxml_get_errors();
+        /// Prepare errors
+            if (!empty($errors)) {
             /// Create one structure to store errors
                 $structure = new XMLDBStructure($this->path);
             /// Add errors to structure