Changing validation rules in an XSD by changing the included XSD types

I have a set of configuration files where I want to create a schema to verify that all settings are set. (There are some 450 settings all in all). This is rather simple, I just create an XSD for each configuration file and then I’m good to go…

I need to use these configuration XSD file over something like 16 different environments with different rules with regards to security. For instance, in dev I want the developers to be able to create new settings, change passwords, connection string and so on. In QA some data is copies of live data so I want to restrict the access to the databases, and in live passwords to credit card vendors, user data, encryption keys and so on are for a limited set of eyes only.

I’ve solved this by using custom types in my XSD and the change the specification of these on the fly. For instance I have a Password type which in development mode is allowed to be unencrypted and everywhere else is encrypted.

By doing this I can have all configuration files in my source repository. The build server is able to validate the configuration files. And I can have a settings provider which decrypts en values on read.

Rather smart I think… I’ll post the code when done.

--- update 0:33 ---
Go the include/import of schemas working. Why so difficult...

No comments:

Post a Comment