6 public static $arSupportedExtensions = array(
10 public function run(File $file)
12 $fpath = $file->getFullPath();
13 $fpathlen = strlen($fpath);
15 $res = new Tool_Result();
16 $cmd = 'xmllint --noout ' . escapeshellarg($fpath) . ' 2>&1';
17 exec($cmd, $output, $retval);
19 $res->annotations['general'][] = new Tool_Result_Line(
20 'XML is well-formed', 'ok'
25 for ($i = 0; $i < count($output); $i += 3) {
27 if (substr($line, 0, $fpathlen) != $fpath) {
28 throw new Exception('xmllint does not behave as expected: ' . $line);
30 list($linenum, $msg) = explode(':', substr($line, $fpathlen + 1), 2);
31 $res->annotations[$linenum][] = new Tool_Result_Line(
36 $res->annotations['general'][] = new Tool_Result_Line(
37 'XML is not well-formed', 'error'