Chapter 6. RDB and XML integration 117
Example 6-6 DTD generated by the Show table as Attributes option
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT SQLResult (PASSENGER_SCHEDULE_AIRCRAFT)*>
<!ELEMENT PASSENGER_SCHEDULE_AIRCRAFT EMPTY>
<!ATTLIST PASSENGER_SCHEDULE_AIRCRAFT
FLIGHT CDATA #REQUIRED
NAME CDATA #REQUIRED
MEMBERSHIP CDATA #REQUIRED
AIRCRAFT CDATA #REQUIRED
DEPARTURE CDATA #REQUIRED
ARRIVAL CDATA #REQUIRED
TYPE CDATA #REQUIRED
>
When the Primary keys as attributes option is selected, the flight and
membership columns are generated as attributes, the remaining columns are
produced as elements.
With the Foreign key as links option, the aircraft column is also generated as an
attribute. Additionally, an selectPassengerList_AIRCRAFT.dtd file is generated,
which is shown below:
Example 6-7 DTD for AIRCRAFT table with the Show tables as Foreign keys as links
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT SQLResult (AIRCRAFT)*>
<!ELEMENT AIRCRAFT (TYPE) >
<!ATTLIST AIRCRAFT
AIRCRAFT_KEY ID #REQUIRED
>
<!ELEMENT TYPE (#PCDATA)>
The Query template file
To generate the Query template file, the user needs to tick the Generate quer y
template file in the Save query box as can be seen in Figure 5-2.
Example 6-8 The Query template file for Passenger List select
<?xml version="1.0" encoding="UTF-8"?>
<SQLGENERATEINFORMATION>
<DATABASEINFORMATION>
<LOGINID>osamurs3</LOGINID>
<PASSWORD><![CDATA[osamurs3]]></PASSWORD>
<JDBCDRIVER>COM.ibm.db2.jdbc.app.DB2Driver</JDBCDRIVER>