![]() |
Previous Top Next |
XML Import based on DB Schema
|
1. | Open the DBschema2xml.xsd schema file supplied with XML Spy (Tutorial folder).
|
![]() |
2. | Select the menu option Convert | XML Import based on DB Schema.
|
This opens the "Select root table from database schema" dialog box. This is where you define which tables you want to import. The root table becomes the top level table in the table hierarchy you import.
|
![]() |
3. | Click the OK button when you have selected the root table.
|
The "Database import based on Schema" dialog box opens. The select statement, based on your root element choice, is automatically generated and placed in the Select statement text box.
|
|
Please note:
|
You cannot edit the select statement here! You can however, start a new import using the Convert | Import database data... command. The same shape string will then appear in the Select statement text box, where it can be edited.
|
4. | Click the Microsoft Access database radio button.
|
![]() |
5. | Click the Choose file button, and select and select the "DB2schema.mdb" file as the source of the database data (in the Tutorial folder).
|
6. | Click the OK button to import the database data.
|
The XML document appears as an "Untitledx.xml" file in the main window.
|
![]() |
7. | Click the Altova element and select the menu option XML | Table | Display as table, or press the F9 function key, to remove the table formatting and display the data vertically. The Division elements were treated the same way to produce the screen shot below.
|
![]() |
In this case the complete database was imported, the root table being Altova. The item Altova Name, was imported as an attribute in keeping with the schema definition DBschema2xml.xsd (visible in the attribute tab of the schema at the beginning of this section).
|
1. | Repeat the above sequence and select Division as the root table.
|
2. | Use the DB2schema.mdb file as the data source.
|
The screen shot shows the resulting XML document. The Person table is expanded and the Division table formatting is disabled for a better overview.
|
![]() |
|