Example 6-13 DAD file that maps the element ’title’ from the DTD

<Xcolumn>

<table name="redbook_title_sidetab"> <column name="title"

type="varchar(100)"

path="/redbook/title" multi_occurence="NO"

</column>

</table>

</Xcolumn>

We can see the following tags in the DAD file shown in Example 5-3:

￿<Xcolumn>, this tag indicates that we are using the XML Column method

￿<table>, this tag identifies the side table that we want to create. A side table is a table that is created if you want to index an element of the XML document. In Example , we want to index the element ’title’ so that we can later search for the XML document by title. The side table redbook_title_sidetab will be created with a column called title, and will have an index pointing to the exact location of the XML document in which the title exists

￿<column>, this tag specifies the columns that the side table will contain. The number of column tags in the DAD file will depend on the elements or attributes of the XML document that you want to index.

We also see that the column tag has four attributes:

name: This attribute specifies the name of the column in the side table.

path: This attribute indicates the location path in the XML document for each element or attribute.

type: This attribute indicates the data type of the table column that will be used to store the element or attribute.

multi-occurrence: This attribute indicates whether the element or attribute referred to by the path attribute can occur more than once in the XML document. In Example , the column tag ’title’ has multi-occurrence set to "NO". This means that, the book will have only one title. All the column tags that have multi-occurrence set to "NO" can be mapped to the table columns within a single DB2 table.

If multi-occurrence is "YES" for a specific column tag, then there can be only one column tag within that table tag. For each element or attribute that has a multi-occurrence value of "YES", we need to declare a separate a table with only one column that corresponds with this "multi-occurrence" element/attribute (see “XML Column method” next).

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

Page 148
Image 148
IBM Version 5 manual