private static void Validate(XmlDocument xmlDocument) { Console.Error.WriteLine("Validating against XML schemas"); SAMLValidator samlValidator = new SAMLValidator(); bool validated = samlValidator.Validate(xmlDocument); Console.Error.WriteLine("Validated: " + validated); if (!validated) { foreach (XmlSchemaException warning in samlValidator.Warnings) { Console.WriteLine(warning.Message); } foreach (XmlSchemaException error in samlValidator.Errors) { Console.WriteLine(error.Message); } } }