public virtual bool ValidateSuppressionFile(XDocument document)
        {
            document.ThrowOnNull(nameof(document));

            ValidationLog validationLog = new ValidationLog();

            foreach (ISuppressionFileValidator validator in AggregatedValidators)
            {
                validator.ValidateSuppressionFile(document, validationLog);
            }

            if (validationLog.ErrorsCount == 0)
            {
                return(true);
            }

            if (ErrorProcessor == null)
            {
                return(false);
            }

            string log = validationLog.GetValidationLog();

            if (log.IsNullOrWhiteSpace())
            {
                log = "Validation of suppression file failed";
            }

            ErrorProcessor.ProcessError(new Exception(log));
            return(false);
        }
        protected virtual void OnSchemaError(ValidationLog validationLog, object sender, ValidationEventArgs e)
        {
            string errorMsg = $"Validation event: {e.Message} | Severity: {e.Severity}";
            string location = GetLocationDescription(sender);

            if (location != null)
            {
                errorMsg += " | " + location;
            }

            validationLog.LogError(errorMsg);
        }
        /// <summary>
        /// Validates the suppression file.
        /// </summary>
        /// <param name="document">The suppression file xml.</param>
        /// <param name="validationLog">The validation log.</param>
        /// <returns/>
        public void ValidateSuppressionFile(XDocument document, ValidationLog validationLog)
        {
            document.ThrowOnNull(nameof(document));
            validationLog.ThrowOnNull(nameof(validationLog));

            try
            {
                document.Validate(_xmlSchemaSet, (sender, e) => OnSchemaError(validationLog, sender, e));
            }
            catch (XmlSchemaValidationException schemaValidationException)
            {
                validationLog.LogError(schemaValidationException.Message);
            }
        }