protected function parseXmlFile($sourcePath)
{
if (!file_exists($sourcePath)) {
throw new Exception\InvalidXmlFileException('The path "' . $sourcePath . '" does not point to an existing and accessible XML file.', 1328879703);
}
libxml_use_internal_errors(true);
$rootXmlNode = simplexml_load_file($sourcePath, 'SimpleXmlElement', \LIBXML_NOWARNING);
if ($rootXmlNode === false) {
$errors = [];
foreach (libxml_get_errors() as $error) {
$errorMessage = trim($error->message) . ' (line ' . $error->line . ', column ' . $error->column;
if ($error->file) {
$errorMessage .= ' in ' . $error->file;
}
$errors[] = $errorMessage . ')';
}
throw new Exception\InvalidXmlFileException('Parsing the XML file failed. These error were reported:' . PHP_EOL . implode(PHP_EOL, $errors), 1278155987);
}
return $this->doParsingFromRoot($rootXmlNode);
}