private function validateWithSchema(DOMDocument $document): void
    {
        $validationErrors = [];
        set_error_handler(function (/** @noinspection PhpUnusedParameterInspection */ $errno, $errstr)
 use (&$validationErrors) {
            array_push($validationErrors, $errstr);
        });

        $isValid = $document->schemaValidate(Constant::$XSD_SCHEMA_PATH);
        restore_error_handler();

        if (!$isValid) {
            throw new XMLSchemaViolationException($validationErrors);
        }
    }