Index: Ringtoets/Common/src/Ringtoets.Common.IO/Readers/ConfigurationReader.cs =================================================================== diff -u -r1d2bc8f06f058cf7bf75fffa684ceca7961ec1de -ra30456917268fbd9a24f24c3695b15389d4ca092 --- Ringtoets/Common/src/Ringtoets.Common.IO/Readers/ConfigurationReader.cs (.../ConfigurationReader.cs) (revision 1d2bc8f06f058cf7bf75fffa684ceca7961ec1de) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Readers/ConfigurationReader.cs (.../ConfigurationReader.cs) (revision a30456917268fbd9a24f24c3695b15389d4ca092) @@ -43,6 +43,8 @@ public abstract class ConfigurationReader where TReadCalculation : IReadConfigurationItem { + private const string defaultSchemaName = "ConfiguratieSchema.xsd"; + private readonly XDocument xmlDocument; /// @@ -153,16 +155,26 @@ /// A string representing the main schema definition. /// A containing /// zero to more nested schema definitions - /// Thrown when the provided XML document does not match the provided schema definitions. - private static void ValidateToSchema(XDocument document, string xmlFilePath, string mainSchemaDefinition, IDictionary nestedSchemaDefinitions) + /// Thrown when the provided XML document does not match + /// the provided schema definitions. + /// Thrown when does not + /// reference the default schema definition ConfiguratieSchema.xsd. + private static void ValidateToSchema(XDocument document, string xmlFilePath, string mainSchemaDefinition, + IDictionary nestedSchemaDefinitions) { - var combinedXmlSchemaDefinition = new CombinedXmlSchemaDefinition(mainSchemaDefinition, nestedSchemaDefinitions - .Concat(new[] - { - new KeyValuePair("ConfiguratieSchema.xsd", Resources.ConfiguratieSchema) - }) - .ToDictionary(kv => kv.Key, kv => kv.Value)); + if (!mainSchemaDefinition.Contains(defaultSchemaName)) + { + throw new ArgumentException($"'{nameof(mainSchemaDefinition)}' does not reference the default schema '{defaultSchemaName}'."); + } + var combinedXmlSchemaDefinition = new CombinedXmlSchemaDefinition( + mainSchemaDefinition, + nestedSchemaDefinitions.Concat(new[] + { + new KeyValuePair(defaultSchemaName, Resources.ConfiguratieSchema) + }) + .ToDictionary(kv => kv.Key, kv => kv.Value)); + try { combinedXmlSchemaDefinition.Validate(document);