[052]<attribute name="ARRIVAL">

[053]

<simpleType>

[054]

<restriction base="string">

[055]

<maxLength value="10"/>

[056]

</restriction>

[057]

</simpleType>

[058]</attribute>

[059]<attribute name="TYPE">

[060]

<simpleType>

[061]

<restriction base="string">

[062]

<maxLength value="30"/>

[063]

</restriction>

[064]

</simpleType>

[065]</attribute>

[066]</complexType>

[067]</element>

[068]</schema>

In contrast to the previous example, every column name is now declared as an attribute. The <restriction> element is still applied every column, but this time all the attributes do not have the ‘nullable’ attribute set to true. All the attributes are within a complexType element ‘PASSENGER_SCHEDULE_AIRCRAFT’.

Also, in the <key> element, this time, the field attributes are declared as

‘@FLIGHT and @MEMBERSHIP, (lines 11 and 12 in Example 5-3) as compared to "PASSENGER_SCHEDULE_AIRCRAFT:FLIGHT" and "PASSENGER_SCHEDULE_AIRCRAFT:MEMBERSHIP" (lines 11 and 12 in Example 5-2).

Choosing option ‘Primary key as attributes’ will produce an XML Schema file which is a combination of the previous two examples. The flight and membership columns are generated as attributes, with the remaining fields produced as elements. The element ‘PASSENGER_SCHEDULE_AIRCRAFT’ now holds a complexType containing the elements with two attributes.

With the ‘Foreign Key as links’ option and the ‘Recurse through Foreign keys’ check box ticked, the AIRCRAFT column now becomes an attribute instead of an element. With that it is removed as element from the complexType element ‘PASSENGER_SCHEDULE_AIRCRAFT’. Also an XML Schema file is also produced for the AIRCRAFT table, which is produced here:

Example 6-4 XML Schema for AIRCRAFT table

<?xml version="1.0" encoding="UTF-8"?>

<schema targetNamespace="http://www.ibm.com/AIRCRAFT" xmlns="http://www.w3.org/2001/XMLSchema"

xmlns:AIRCRAFT="http://www.ibm.com/AIRCRAFT">

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

Page 130
Image 130
IBM Version 5 manual Example 6-4 XML Schema for Aircraft table