Altova XMLSpy 2024 Enterprise Edition

Assign XML Schema

Home Prev Top Next

The Assign XML Schema assigns a schema to an XML file opened for editing via the Result Grid of the Database Query window. After the assignment is made, the XML file can be validated against the assigned schema. The assignment is written to the DB when the XML file is saved in XMLSpy.

 

Opening a DB XML file for editing

In the Database Query window, when a query is addressed to an XML DB and the query is executed for data editing, the Result Grid at the bottom of the Database Query window provides access to the XML files in the database so these can be edited (see screenshot below).

DB2AssignSchemaResWin

Clicking the XML icon icXMLWithEdit pops up the following menu.

DBQueryResWinContextMnu

Selecting the Open for Editing command opens the XML document in XMLSpy, where it can be edited.

 

Assigning a schema to the DB XML file

It is when the DB XML file is opened for editing in XMLSpy that the IBM DB2 | Assign XML Schema command is enabled. With the XML document active in XMLSpy, clicking the Assign XML Schema command pops up the Choose XML Schema dialog (screenshot below).

DB2AssignSchemaDlg

A schema can be selected from among those stored in the database (these are listed in the dropdown list of the Schema from Database combo box), or from among external files that can be browsed. Clicking OK assigns the schema to the XML file. Note that the assignment is not written into the XML file. When the XML file is saved in XMLSpy—and if the Auto-Commit XML changes icon icDBQueryAutoCommitXMLEdit in the Query Database toolbar was selected when the document was openedthen the schema assignment is saved to the database. Note that the schema assignment is written to the database—and not to the XML file.

 

Note:The Edit XML menu in the Result Grid of the Database Query window also has an Assign XML Schema command (see screenshot below), which also assigns a schema to the DB XML file.
DBQueryResWinContextMnu

The difference between the two Assign XML Schema commands is that the command in the DB | IBM DB2 menu enables you to assign an XML Schema while you are editing the XML file thereby allowing you to change schema assignments while editing the XML document and to validate the XML document immediately.

 

© 2017-2023 Altova GmbH