9.2.4 Creating DAD file using RDB to XML mapping

After defining the schema for the output message and setting our database, we can define the listPassenger operation that retrieves the information from the database. Here we plan to use the DB2 XML Extender run-time component to execute the operation and generate the XML result. We must define a DAD file for the retrieval operation.

The Document Access Definitions (DAD) file, is an XML formatted document, it is used to associate the XML document structure to a DB2 database. Basically, it provides the mapping between the elements or attributes of an XML document and the table columns, and the details of how a request for an XML document is to be handled.

To see how to map the database to the DTD file see Figure 9-14.

Schedule

DTD

flightNo

<flight>

aircraft

<flightNo>

departure

<departure>

arrival

<Customer>

 

<name>

 

<membership>

Passenger

 

flight

 

name

 

membership

 

Figure 9-14 RDB to XML mapping

The RDB to XML Mapper tool, shown in Figure 9-16, helps us define the mapping from the database to the XML result:

1.Turn to XML perspective if necessary.

2.Select the project and right-click New—>RDB to XML Mapping.

3.Enter passengerList.rmx as the name of the file, click Next.

4.Select RDB Table to XML Mapping, click Next.

5.Select the source tables Passenger and Schedule, click Next.

6.Then select the target DTD file passengerList.dtd, select Flight as the root element, and click Finish.

196 The XML Files: Development of XML/XSL Applications Using WebSphere Studio

Page 212
Image 212
IBM Version 5 manual Creating DAD file using RDB to XML mapping, Membership, Select RDB Table to XML Mapping, click Next