Creating the mapping for an RDB_node DAD file
An RDB_node mapping document access definition (DAD) file is created with a relational database table to a DTD mapping. The DAD can be used to store and retrieve data from DB2 databases.
The following instructions were written for the Resource perspective, but they will also work in many other perspectives.
To map one or more database table columns to a node in the XML document:
- Open your mapping in the RDB to XML mapping editor.
- Select the column in the Tables pane.
- Select the node that you wish to map to from the XML pane.
- Right-click and click Create Mapping.
One column can be mapped to many XML nodes, but each XML node can only be mapped to by one column.
You can use the Match Mapping option to map columns and nodes with common names. When you select the table from the Tables pane and an XML node from the XML pane, the tool will map the selected objects, then it will attempt to map the columns in the table to the children of the selected XML node based on common names. The process continues until all of the table columns and descendant XML nodes with common names are mapped.
To map columns and nodes with the same name:
- Open your mapping in the RDB to XML mapping editor.
- Select the table in the Tables pane and the XML node to be mapped. They do not have to have a common name, but they will be mapped.
- Select Mapping > Match Mapping.
To remove a mapping, right-click the mapping in the Outline view and click Remove Mapping.
You can add more RDB tables to the editor by clicking Mapping > Add Source RDB Tables.
Selecting options
Choice support enables you to dynamically select or map any member of a choice in the XML pane during a mapping session. You are only allowed to map one member of a choice; consequently, selecting a new member of a choice automatically removes any existing mappings related to the previously selected member.
To create a mapping using a choice member currently not shown in the XML pane:
- Open your mapping in the RDB to XML mapping editor.
- Select the choice member that is currently shown in the XML pane. An arrow will appear next to it. Click the arrow and select the appropriate member from the drop down menu.
- Create the mapping. Any mappings associated with the previously selected member is automatically removed.
For example:
- You select Person.dtd as your target file, which contains a choice with the two members: Province and State.
- When you open your mapping session, Province is in the XML pane. You create a mapping between a column called Location in the Tables pane and Province in the XML pane.
- You then click Province in the XML pane and select State from the drop down menu. Your previous mapping between Location and Province is now gone. You can now create a new mapping between Location and State.
Parent topic
Editing an RDB to XML mapping
Related concepts
Relational database to XML mapping (visual DAD builder)
Related tasks
Specifying the source tables and target DTD file
Editing an RDB to XML mapping
Creating the mapping for an SQL statement DAD file
Creating join conditions