AlvarCrash
Новичок
Здравствуйте!
Есть надобность проверить xml файл на соответствие схеме. Вроде все просто:
$file = 'D:\PHP\407p\XSD\RFM_044555567_20160325_001.xml';
$schema = 'D:\PHP\407p\XSD\RequestSchema.xsd';
$ab = new DOMDocument;
$ab->load($file);
if ($ab->Schemavalidate($schema)) {
print "$file is valid.\n";
} else {
print "$file is invalid.\n";
}
НО!
Выпадает куча ошибок:
Warning: DOMDocument::schemaValidate(): failed to compile: expecting a branch after | in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): Element '{http://www.w3.org/2001/XMLSchema}pattern': The value '(0|\-?[1-9][0-9]*)|' of the facet 'pattern' is not a valid regular expression. in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): failed to compile: expecting a branch after | in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): Element '{http://www.w3.org/2001/XMLSchema}pattern': The value '\-?(0?|[1-9][0-9]*)\.[0-9]+|' of the facet 'pattern' is not a valid regular expression. in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): failed to compile: expecting a branch after | in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): Element '{http://www.w3.org/2001/XMLSchema}pattern': The value '(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/([1-9]\d{3})|' of the facet 'pattern' is not a valid regular expression. in D:\PHP\407p\test.php on line 7
Нутром чую, что косяк в самой схеме - что-то не нравиться, но проблема в том, что схема не моя, как и сам xml - и изменению не подлежат =( А валидацию провести надо... Ткните носом пожалуйста, где тут косяк? Спасибо!
Есть надобность проверить xml файл на соответствие схеме. Вроде все просто:
$file = 'D:\PHP\407p\XSD\RFM_044555567_20160325_001.xml';
$schema = 'D:\PHP\407p\XSD\RequestSchema.xsd';
$ab = new DOMDocument;
$ab->load($file);
if ($ab->Schemavalidate($schema)) {
print "$file is valid.\n";
} else {
print "$file is invalid.\n";
}
НО!
Выпадает куча ошибок:
Warning: DOMDocument::schemaValidate(): failed to compile: expecting a branch after | in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): Element '{http://www.w3.org/2001/XMLSchema}pattern': The value '(0|\-?[1-9][0-9]*)|' of the facet 'pattern' is not a valid regular expression. in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): failed to compile: expecting a branch after | in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): Element '{http://www.w3.org/2001/XMLSchema}pattern': The value '\-?(0?|[1-9][0-9]*)\.[0-9]+|' of the facet 'pattern' is not a valid regular expression. in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): failed to compile: expecting a branch after | in D:\PHP\407p\test.php on line 7
Warning: DOMDocument::schemaValidate(): Element '{http://www.w3.org/2001/XMLSchema}pattern': The value '(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/([1-9]\d{3})|' of the facet 'pattern' is not a valid regular expression. in D:\PHP\407p\test.php on line 7
Нутром чую, что косяк в самой схеме - что-то не нравиться, но проблема в том, что схема не моя, как и сам xml - и изменению не подлежат =( А валидацию провести надо... Ткните носом пожалуйста, где тут косяк? Спасибо!
Вложения
-
6,8 KB Просмотры: 6