XML Extender Administration and Programming
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.
- Understand the hierarchical structure of your XML data so that you can
define key elements and attributes for indexing and fast search.
- Prepare and insert the XML document's DTD into the DTD_REF
table. This step is required for validation.
Use the following steps to create a DAD file:
- Set up and start the administration wizard. See Starting the administration wizard for details.
- Click Work with DAD files from the LaunchPad window to edit or
create an XML DAD file. The Specify a DAD file window opens.
- Choose whether to edit an existing DAD file or to create a new DAD
file.
- To edit an existing DAD:
- Click ... to browse for an existing DAD
file in the pull-down menu, or type the DAD file name into the File
name field.
- Verify that the wizard recognizes the specified DAD file.
- If the wizard recognizes the specified DAD file, Next is
selectable, and XML column is displayed in the Type field.
- If the wizard does not recognize the specified DAD file, Next
is not selectable. Either retype the DAD file name into the File
name field, or click Open to browse again for an existing DAD
file. Continue until Next is selectable.
- Click Next.
- To create a new DAD:
- Leave the File name field blank.
- From the Type menu, click XML column.
- Click Next.
- Choose whether to validate your XML documents with a DTD from the Select
Validation window.
- Click Next.
- Choose whether to add a new side table, edit an existing side table, or
remove an existing side table from the Side tables window.
- To add a new side table or side-table column:
To add a new side table, you define the columns in the table.
Complete the following steps for each column in a side table.
- Complete the fields of the Details box of the Side tables
window.
- Table name: Type the name of the table containing the
column. For example:
ORDER_SIDE_TAB
- Column name: Type the name of the column. For
example:
CUSTOMER_NAME
- Type: Select the type of the column from the menu.
For example:
XMLVARCHAR
- Length (VARCHAR type only): Type the maximum number of
VARCHAR characters. For example:
30
- Path: Type the location path of the element or
attribute. For example:
/ORDER/CUSTOMER/NAME
See Location path for location path syntax.
- Multi occur: Select No or Yes from
the menu.
Indicates whether the location path of this element or attribute can be
used more than once in a document.
Important If you specify multiple occurance for a column, you can specify
only one column in the side table which contains the column.
- Click Add to add a column.
- Continue adding, editing, or removing columns for the side table, or click
Next.
- To edit an existing side table column:
You can update a side table by changing the definitions of the existing
columns.
- Click on the side table and column name you want to edit.
- Edit the fields of the Details box.
- Click Change to save changes.
- Continue adding, editing, or removing columns for each side table, or
click Next.
- To remove an existing side-table column:
- Click on the side table and column you want to remove.
- Click Remove.
- Continue adding, editing, or removing side-tables columns, or click
Next.
- To remove an existing side table:
To remove an entire side table, you delete each column in the table.
- Click on each side table column for the table you want to remove.
- Click Remove.
- Continue adding, editing, or removing side tables columns, or click
Next.
- Type an output file name for the modified DAD file in the File
name field of the Specify a DAD window.
- Click Finish to save the DAD file and to return to the
LaunchPad window.
The DAD file is an XML file that can be created in any text editor.
Use the following steps to create a DAD file:
- Open a text editor.
- 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
- Insert the <DAD></DAD> tags.
- 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).
- 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.
- Use the <Xcolumn> element to define the access and storage method as
XML column.
<Xcolumn>
</Xcolumn>
- 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:
- Insert the <TABLE></TABLE> tags and the name attribute.
<table name="order_tab">
</table>
- 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>
- Ensure that you have an ending </TABLE> tag after the last column
definition.
- Ensure that you have an ending </Xcolumn> tag after the last
</TABLE> tag.
- Ensure that you have an ending </DAD> tag after the </Xcolumn>
tag.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]