15 $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
20 function ($filename) {
21 $dom = new \DOMDocument();
23 $dom->loadXML($xmlFile);
25 libxml_clear_errors();
28 $schemaLocations = [];
29 preg_match(
'/xsi:noNamespaceSchemaLocation=\s*"(urn:[^"]+)"/s', $xmlFile, $schemaLocations);
32 count($schemaLocations),
33 'The XML file at ' . $filename .
' does not have a schema properly defined. It should ' 34 .
'have a xsi:noNamespaceSchemaLocation attribute defined with a URN path. E.g. ' 35 .
'xsi:noNamespaceSchemaLocation="urn:magento:framework:Relative_Path/something.xsd"' 40 }
catch (\Exception $exception) {
41 $errors = [$exception->__toString()];
45 "Error validating $filename against {$schemaLocations[1]}\n" . print_r(
$errors,
true)
57 $codeSchemas = array_merge($codeSchemas, $this->
_getFiles($modulePath,
'*.xsd'));
63 return $this->
_dataSet(array_merge($codeSchemas, $libSchemas));
71 $codeXml = array_merge($codeXml, $this->
_getFiles($modulePath,
'*.xml',
'/.\/Test\/./'));
73 $this->_filterSpecialCases($codeXml);
76 $designXml = array_merge($designXml, $this->
_getFiles($themePath,
'*.xml'));
82 return $this->
_dataSet(array_merge($codeXml, $designXml, $libXml));
89 if (empty($skipDirPattern) || !preg_match($skipDirPattern, $dir)) {
90 foreach (glob($dir .
'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $newDir) {
103 private function _filterSpecialCases(&
$files)
106 '#etc/countries.xml$#',
107 '#conf/schema.xml$#',
108 '#layout/swagger_index_index.xml$#',
109 '#Doc/etc/doc/vars.xml$#',
111 '#etc/db_schema.xml$#',
126 foreach (
$files as $file) {
127 $data[substr($file, strlen(
BP))] = [$file];
static validateDomDocument(\DOMDocument $dom, $schema, $errorFormat=self::ERROR_FORMAT_DEFAULT)
if(isset($opts->l)) $libraryPath
_getFiles($dir, $pattern, $skipDirPattern='')
foreach($appDirs as $dir) $files