-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidator.php
More file actions
27 lines (25 loc) · 916 Bytes
/
validator.php
File metadata and controls
27 lines (25 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
$FILE_QML_CACHE="input.xml";
echo "\n";
if (file_exists($FILE_QML_CACHE)) {
libxml_use_internal_errors(true);
$xml = new DOMDocument();
$xml->load("$FILE_QML_CACHE");
echo "Validating $FILE_QML_CACHE with schema 1.2 \n";
if ( !$xml->schemaValidate('./1.2/QuakeML-1.2.xsd') ) {
$errors = libxml_get_errors();
foreach ($errors as $error) {
$validation_error = " XML error:\n MESSAGE=$error->message LEVEL=[$error->level]\n CODE=$error->code\n FILE=$error->file\n LINE=$error->line \n\n";
}
echo " QuakeML is not valid: \n$validation_error";
libxml_clear_errors();
}
else {
echo " QuakeML is valid. \n";
}
libxml_use_internal_errors(false);
} else {
echo "The file $FILE_QML_CACHE doesn't exist";
}
echo "\n";
?>