You can assign an XML schema to a database column or, in DB2 databases, field of type XML. This schema is used for data validation when an INSERT or UPDATE action is performed. The Choose XML Schema dialog box lists the XML schema that is currently assigned to an XML column/data cell and allows you to assign an XML schema to the selected column/cell.
You can choose one of the existing XML schemas that are registered with the database. If you want to add an additional XML schema to the database, click the Manage Schemas... button.
After you have assigned an XML schema to an XML column/field, you must commit the changes to the database. At this stage, DatabaseSpy validates the XML file that is contained in the XML column/field against the assigned XML schema and reports any errors to the Message tab. If the validation fails, the XML schema assignment cannot be committed to the database.
To assign an XML schema to a database column or field of type XML:
1.Depending on the database type, do one of the following:
•In DB2 databases, and provided that the Result window is in the Editing mode, click the Browse button in the XML data cell you want to edit, and choose Assign XML Schema from the menu that appears.
•In SQL Server databases, right-click the column in the Online Browser and choose Assign XML Schema... from the context menu.
The Choose XML Schema dialog box opens.
2.Do one of the following:
•Select the Schema from Database radio button and choose one of the registered XML schemas from the drop-down list. Optionally, click the Manage Schemas... button to add a schema to the database.
•To remove any XML schema assignment from the column/data cell, select the None radio button.
4.Depending on the database type, do one of the following:
•In DB2 databases, click the button in the Result window.
•In SQL Server databases, execute the change script.