IBM Books

XML Extender Administration and Programming

Creating or editing the DAD file

When you specify a DAD file, you define the attributes and key elements of your data that need to be searched. The XML Extender uses this information to create side tables so that you can index your data to retrieve it quickly. See The DAD file to learn about planning issues for creating the DAD file.

Before you begin

Using the administration wizard

Use the following steps to create a DAD file:

  1. Set up and start the administration wizard. See Starting the administration wizard for details.
  2. Click Work with DAD files from the LaunchPad window to edit or create an XML DAD file. The Specify a DAD file window opens.
  3. Choose whether to edit an existing DAD file or to create a new DAD file.
  4. Choose whether to validate your XML documents with a DTD from the Select Validation window.
  5. Click Next.
  6. Choose whether to add a new side table, edit an existing side table, or remove an existing side table from the Side tables window.
  7. Type an output file name for the modified DAD file in the File name field of the Specify a DAD window.
  8. Click Finish to save the DAD file and to return to the LaunchPad window.

From the DB2 command shell

The DAD file is an XML file that can be created in any text editor.

Use the following steps to create a DAD file:

  1. Open a text editor.
  2. Create the DAD file header, using the following syntax:
    <?xml version="1.0"?> 
    <!DOCTYPE DAD SYSTEM "path\dtd\dad.dtd"> --> the path and file name of 
           the DTD for the DAD file 
     
    
  3. Insert the <DAD></DAD> tags.
  4. Inside the <DAD> tag, optionally specify the DTD ID identifier that associates the DAD file with the XML document DTD for validation:
    <dtdid>path\dtd_name.dtd</dtdid> --> the path and file 
           name of the DTD
                                         for your application 
    

    The DTD ID is required for validation and must match the DTD ID value used when inserting the DTD into the DTD reference table (db2xml.DTD_REF).

  5. Specify whether to validate (that is, to use a DTD to ensure that the XML document is a valid XML document). For example:
    <validation>YES</validation>   --> specify YES or NO
    

    If you specify YES, you must have specified a DTD ID in the previous step as well as inserted a DTD into the DTD_REF table.

  6. Use the <Xcolumn> element to define the access and storage method as XML column.
    <Xcolumn>
    </Xcolumn>
    
  7. Define each side table and the important elements and attributes to be indexed for structural search. Perform the following steps for each table. The following steps use examples taken from a sample DAD file shown in DAD file: XML column:
    1. Insert the <TABLE></TABLE> tags and the name attribute.
      <table name="order_tab">
      </table>
      
    2. After the <TABLE> tag, insert a <COLUMN> tag and its attributes for each column in the table:
      • name: the name of the column
      • type: the type of column
      • path: the location path of the element or attribute. See Location path for location path syntax.
      • multi_occurrence: an indication of whether this element or attribute can be used more than once in a document
      <table ...>
         <column name="order_key"
                 type="integer"
                 path="/Order/@key"
                 multi_occurrence="NO"/>
         <column name="customer"
                 type="varchar(50)"
                 path="/Order/Customer/Name"
                 multi_occurrence="NO"/>
      </table>
      
  8. Ensure that you have an ending </TABLE> tag after the last column definition.
  9. Ensure that you have an ending </Xcolumn> tag after the last </TABLE> tag.
  10. Ensure that you have an ending </DAD> tag after the </Xcolumn> tag.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]