Only validate against schema if we have a schema. ;-)

This commit is contained in:
stronk7
2007-02-23 23:56:55 +00:00
parent 9ee705e74a
commit 686bbac879
+8 -4
View 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