Reputation: 408
I'm doing some maintenance work on an application that stores its XML data in SQL Server. Currently, the application uses another table to store associated XSDs. My question: since all XSD validation is currently being performed in ASP.NET, is there any advantage to storing the XSDs in an XML SCHEMA COLLECTION instead?
Upvotes: 1
Views: 399
Reputation: 3145
It's a fair question... I would still put it in an XML schema collection. That forces the validation of the data at the lowest possible level.
If it's possible to put bad data into a column, it WILL happen. All it takes is another developer working on your app who is not as careful as you are, or another internal app hitting the same table, or any of a bunch of other situations.
It's like storing INT values in a column of type VARCHAR. You can do it... and maybe your application is validating that the data going in there is indeed of type INT. But somehow or other, the value "10N" will eventually find its way into the column. Then what? One of the great things about a relational DB is that it enforces a certain level of data validity, so you should use every tool at your disposal, including schema collections, IMO.
Upvotes: 1