From 11548d9bf93dbfe18a99ce1a444f35770ac4a733 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 24 Feb 2007 00:05:05 +0000 Subject: [PATCH] Only validate against schema if we have a schema. ;-) Merged from MOODLE_18_STABLE --- lib/xmldb/classes/XMLDBFile.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/xmldb/classes/XMLDBFile.class.php b/lib/xmldb/classes/XMLDBFile.class.php index b39c8c7fbd..6e5dfdc5db 100644 --- a/lib/xmldb/classes/XMLDBFile.class.php +++ b/lib/xmldb/classes/XMLDBFile.class.php @@ -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 -- 2.39.5