This section describes the document type declarations (DTD) for the document access definition (DAD) file. The DAD file itself is a tree-structured XML document and requires a DTD. The DTD file name is dxxdad.dtd. Figure 13 shows the DTD for the DAD file. The elements of this file are described following the figure.
Figure 13. The DTD for the document access definition (DAD)
<?xml encoding="US-ASCII"?> <!ELEMENT DAD (dtdid?, validation, (Xcolumn | Xcollection))> <!ELEMENT dtdid (#PCDATA)> <!ELEMENT validation (#PCDATA)> <!ELEMENT Xcolumn (table*)> <!ELEMENT table (column*)> <!ATTLIST table name CDATA #REQUIRED key CDATA #IMPLIED orderBy CDATA #IMPLIED> <!ELEMENT column EMPTY> <!ATTLIST column name CDATA #REQUIRED type CDATA #IMPLIED path CDATA #IMPLIED multi_occurrence CDATA #IMPLIED> <!ELEMENT Xcollection (SQL_stmt?, objids?, prolog, doctype, root_node)> <!ELEMENT SQL_stmt (#PCDATA)> <!ELEMENT objids (column+)> <!ELEMENT prolog (#PCDATA)> <!ELEMENT doctype (#PCDATA | RDB_node)*> <!ELEMENT root_node (element_node)> <!ELEMENT element_node (RDB_node*, attribute_node*, text_node?, element_node*, namespace_node*, process_instruction_node*, comment_node*)> <!ATTLIST element_node name CDATA #REQUIRED ID CDATA #IMPLIED multi_occurrence CDATA "NO" BASE_URI CDATA #IMPLIED> <!ELEMENT attribute_node (column | RDB_node)> <!ATTLIST attribute_node name CDATA #REQUIRED> <!ELEMENT text_node (column | RDB_node)> <!ELEMENT RDB_node (table+, column?, condition?)> <!ELEMENT condition (#PCDATA)> <!ELEMENT comment_node (#PCDATA)> <!ELEMENT namespace_node (EMPTY)> <!ATTLIST namespace_node name CDATA #IMPLIED value CDATA #IMPLIED> <!ELEMENT process_instruction_node (#PCDATA)> |
The DAD file has four major elements:
Xcolumn and Xcollection have child element and attributes that aid in the mapping of XML data to relational tables in DB2. The following list describes the major elements and their child elements and attributes. Syntax examples are taken from Figure 13.
Syntax: <!ELEMENT dtdid (#PCDATA)>
Syntax: <!ELEMENT validation(#PCDATA)>
Syntax: <!ELEMENT Xcolumn (table*)>Xcolumn has one child element, table.
Syntax:
<!ELEMENT table (column+)> <!ATTLIST table name CDATA #REQUIRED key CDATA #IMPLIED orderBy CDATA #IMPLIED>
The table element has one attribute:
The table element has one child element:
Syntax:
<!ATTLIST column name CDATA #REQUIRED type CDATA #IMPLIED path CDATA #IMPLIED multi_occurrence CDATA #IMPLIED>The column element has the following attributes:
Syntax: <!ELEMENT Xcollection(SQL_stmt*, prolog, doctype, root_node)>Xcollection has the following child elements:
Syntax: <!ELEMENT SQL_stmt #PCDATA >
Syntax: <!ELEMENT prolog #PCDATA>
Syntax: <!ELEMENT doctype #PCDATA | RDB_node>doctype can be specified in one of the following ways:
Syntax: <!ELEMENT root_node(element_node)>
Syntax:
An element_node is defined by the following child elements:
Syntax:
The attribute_node must have definitions for a name attribute, and either a column or a RDB_node child element. attribute_node has the following attribute:
attribute_node has the following child elements:
Syntax: It must be defined by a column or an RDB_node child element: