XML and the SQL 2000 Server part 3: XML Data with XPath Queries - Generating and Mapping an XDR Schema
(Page 5 of 8 )
Generating an XDR Schema
Now going to the main menu and clicking on Tools->Utilities->Generate XDR Module will automatically generate an XDR schema, and will be added to the XDR Modulesfolder in the Project explorer as shown in the picture that follows with the extension .smx.
Mapping Schema
Now drag and drop the XDR schema into the right panel in the Map Editor. This creates an untitled Map in the Map Module in the project explorer with the extension .smm, an internal format type used by Microsoft[which includes .smt and .smx discussed earlier].
By expanding all the nodes you can verify the type of mapping that is made. If you right click any of the connecting links between the SQL schema and the XDR you will bring up a menu item from which you may choose to carry out a number of things. The broken lines represent what is called the implicit mappings. It is possible to make an explicit mapping by keeping the mouse on the SQL object and draw a line[called the mapping line] to the XDR element. Any forbidden mappings [that are not allowed by Xpath queries] that you may attempt will be notified by a message with a warning icon.
For example, an explicit connection was made from NumID in the SQL's nums table to the numid in the XDR's Color elements numid attribute, and this brings up the XML View Mapper Path finder as shown and if accepted, this will create an explicit relationship as shown in the picture that follows. Explicit relationships may be deleted and edited. The settings for Map Editor, Mapping Format, and Mapping Filter can be found in Tools->Options and the information on the mapping lines is stored in the Map Modules.
The XDR Schema can be edited using a text editor which can accessed by right clicking on a mapping line and choosing the XDR Editor. To close this window you may use the Update Project and Close from the File Menu's drop down list.
Next: Testing an Xpath Query Using the Internal Tester >>
More MS SQL Server Articles
More By Jayaram Krishnaswamy