Neos\Flow\I18n\AbstractXmlParser::parseXmlFile PHP Method

parseXmlFile() protected method

Reads and parses XML file and returns internal representation of data.
protected parseXmlFile ( string $sourcePath ) : array
$sourcePath string An absolute path to XML file
return array Parsed XML file
    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);
    }