XML Databases

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  SPS File and Databases > DB Data Selection >

XML Databases

After having made the connection to the XML database (currently only IBM DB2 XML databases are supported) via the Open Database dialog (via the File | New | New from XML Column in DB Table command; see previous sections), you will need to do two things:

 

Select the cell in the DB that contains the required XML document. The XML document will be loaded automatically as the Working XML File.
Select the XML Schema for the SPS.

 

Selecting the XML Cell and Working XML File

After making the connection to the IBM DB2 database, the Select XML Table dialog (screenshot below) appears.

 

1.In the Select XML Table dialog, select the table that contains the XML data you wish to create as the Working XML File. In the screenshot below, the table NHE_TEST has been selected.

 

dlg_SelectXMLTable1

 

2.Click Next. This pops up the Choose XML Field dialog (screenshot below). If you wish to filter the selection displayed in the pane, enter an SQL WHERE clause and click Update. Note that the WHERE clause should be just the condition (without the WHERE keyword, for example: NHE_TEST_TEXT= 'Two')

 

dlg_ChooseXMLCell

 

3.Select the cell containing the XML data you wish to create as the Working XML File. In the screenshot above, the selected cell is highlighted in blue.
4.Click Next. This pops up the Choose XML Schema dialog, in which you select the schema to be used for the SPS. See next section.

 

Note:If you connect to an Oracle or IBM DB2 database using JDBC and use a SELECT statement with the Add/Remove Table command to retrieve data, then the SELECT statement must have no final semicolon.

 

Selecting the XML Schema for the SPS

The schema that will be used for the SPS can be either an XML Schema contained in the DB or a schema at a file location that can be accessed by StyleVision. To select the schema, do the following:

 

1.In the Choose XML Schema dialog (screenshot below), select the appropriate radio button according to whether you wish to select the schema from among those stored in the DB or from a file location. Note that if a non-DB schema is selectedthat is, a schema from an external filethen no DB validation will be carried out.

 

dlg_ChooseXMLSchema

 

2.Select the schema. Schemas stored in the DB are listed in the dropdown list of the Schemas from Database combo box, and can be selected from there. An external schema can be selected by browsing for it.
3.Click Finish to complete.

 

The schema tree

After completing the process to select the XML data and the schema, the selected XML data is created as the Working XML File and the schema is loaded into the SPS. Both are displayed in the Schema Tree window (screenshot below).

 

WinSchemaSrcDB2XML

 

The SPS can now be built using the usual StyleVision mechanisms. Note that the data in the Working XML File can be edited in Authentic View and saved to the DB.

 

Note:The Working XML File should be valid against the schema selected for the SPS. Also ensure that the schema's root element (document element) corresponds to the root element of the XML document.

 


© 2019 Altova GmbH