/** * Add a violation to the file. * * @param SimpleXMLElement $file The file where the error should be added * @param Violation $violation The violation to add * @param string $severity Should be either error or warning */ protected function addViolation(SimpleXMLElement $file, Violation $violation, $severity) { $xmlViolation = $file->addChild('error'); $xmlViolation->addAttribute('severity', $severity); $xmlViolation->addAttribute('line', $violation->getLine()); $xmlViolation->addAttribute('column', $violation->getColumn()); $xmlViolation->addAttribute('message', $violation->getMessage()); $xmlViolation->addAttribute('source', 'HTMLValidation'); }