src/File.php
public static function parseXml(string $file): SimpleXMLElement
	{
		libxml_use_internal_errors(true);
		$xml = simplexml_load_file($file);

		if (!$xml) {
			/* @var $errors LibXMLError[] */
			$errors = libxml_get_errors();

			$return = '';
			foreach ($errors as $error) {
				switch ($error->level) {
					case LIBXML_ERR_WARNING:
						$return .= "Warning $error->code ";
						break;
					case LIBXML_ERR_ERROR:
						$return .= "Error $error->code ";
						break;
					case LIBXML_ERR_FATAL:
						$return .= "Fatal Error $error->code ";
						break;
				}
				$return .= "on line $error->line and column $error->column: " . trim($error->message) . ". ";
			}

			$return .= "File: $file";

			libxml_clear_errors();
			libxml_use_internal_errors(false);
			throw new IOException($return);
		}
		libxml_use_internal_errors(false);
		return $xml;
	}
public static function parseXml(string $file): SimpleXMLElement
	{
		libxml_use_internal_errors(true);
		$xml = simplexml_load_file($file);

		if (!$xml) {
			/* @var $errors LibXMLError[] */
			$errors = libxml_get_errors();

			$return = '';
			foreach ($errors as $error) {
				switch ($error->level) {
					case LIBXML_ERR_WARNING:
						$return .= "Warning $error->code ";
						break;
					case LIBXML_ERR_ERROR:
						$return .= "Error $error->code ";
						break;
					case LIBXML_ERR_FATAL:
						$return .= "Fatal Error $error->code ";
						break;
				}
				$return .= "on line $error->line and column $error->column: " . trim($error->message) . ". ";
			}

			$return .= "File: $file";

			libxml_clear_errors();
			libxml_use_internal_errors(false);
			throw new IOException($return);
		}
		libxml_use_internal_errors(false);
		return $xml;
	}
Parsuje XML
@param string $file
@return SimpleXMLElement
@throws IOException