Mappings Tab

The Mappings tab allows you to create mappings between XML schema or DTD elements or attributes and database columns, expressions or constants. The Mappings tab consists of three main panes and one optional pane:

XML Schema/DTD pane -- Displays elements and attributes in an XML Schema/DTD specified in the Mapper wizard.

Database pane -- Displays selected tables from a relational database specified in the Mapper wizard.

XML Mappings pane -- Displays mappings that have been created.

Column Information pane -- Appears in the Database pane after clicking View Column Information in the Database toolbar.

This topic also explains how to access the Mappings tab.

How to Create Mappings

You can create mappings in the following ways:

- select an element or attribute in the left pane and a database column in the right pane, then click  Map Column in the Schema/DTD Toolbar

or,

- click and hold down the mouse over an element or attribute in the left pane, move the mouse over to the database column in the right pane, then release it to create a mapping.

When you create a mapping for a node, it is displayed in the XML Mappings pane, and a blue line connects the mapped node and database column. If the mapping is appropriate to use both in marshalling data to XML and unmarshalling data to a database, it appears on both the Mappings for Marshalling and Mappings for Unmarshalling tabs.

How to Remove Mappings

You can delete mappings in the following ways:

How to View Multiple Mapping Lines

When you create a mapping, by default the Mappings tab displays the mapping line for the currently selected node or column. You can also display mapping lines for all mappings or for a subtree.

  1. Select the top node in the XML Schema pane.

  2. From the right mouse button menu, choose Reveal All Mappings for Subtree.

 

XML Schema/DTD File Pane

This pane displays XML Schema or DTD elements and allows you to map XML elements to columns, expressions and constants. By default, XML nodes do not display any namespace information. Use the XML Schema tab in the Project Properties dialog to view namespaces in the XML Schema/DTD pane.

In the Mappings tab, you can also:

For large schemas or DTDs, you can control which elements you view by clicking Add/Remove Global Elements in the Schema/DTD pane and selecting elements for display in the Select XML Elements dialog.

The schema/DTD tree uses the following conventions:

 

 

An element that can be mapped

 

An element that has been mapped

An element that has been mapped and used as a key for combining XML output nodes.

 

An attribute that can be mapped

 

An attribute that has been mapped

An attribute that has been mapped and used as a key for combining XML output nodes.

A hidden attribute that can be mapped

A hidden attribute that has been mapped

A hidden attribute that has been mapped and used as a key for combining XML output nodes.

An element or attribute that cannot be mapped

Elem

An element that has been mapped where the element name in bold type means that the Combined Node property has also been set on the element in the XML Structure tab.

 

Database Pane

Shows the tables that you selected in the New Project wizard, generated from an XML schema in the New Project wizard, or selected using the Add/Remove Database Tables dialog. You can add or remove tables by clicking  Add/Remove Tables in the main toolbar.

Table columns are displayed in the Database pane in the order that is used in the database. If you have many columns and need to locate them by name, you can display the columns alphabetically. Select a table and choose Sort Table Columns from the right mouse button menu.

When the Mapper loads database information, it also loads information about primary keys for each table and columns with auto-increment identifiers. In the database tree, columns in bold represent primary keys in the database.  

To view detailed column information:

  1. Select a column in the tree.

  2. Click View Column Information.

The Column Information pane is displayed to the right of the Database pane.

The Database Pane uses the following conventions:

 

A SQL Query folder. The database columns that appear below this folder have been retrieved using a SQL query entered during project creation or using  Show SQL Select Query in the main toolbar.

A table retrieved from the database

A user-defined table

A table alias

A database column that can be mapped

A database column that has been mapped

Col

A database column that is a primary key in the database

 

Column Information Pane

This is not visible by default. To view the table:

It contains meta data for the column, including the data type and size.

 

XML Mappings Pane

The XML Mappings pane consists of two tabs: Mappings for Marshalling and Mappings for Unmarshalling. When you have made a mapping that applies to both marshalling and unmarshalling (mapping an element to a column for example), it appears on both tabs. If you map a database column to an XML expression, for example, it appears on the Mappings for Unmarshalling tab.  Both tabs by default show the mappings for a selected node's subtree in the XML Schema/DTD pane. You can also view mappings for a single node.

Single Node View

You can perform the following operations on a single node.

If you have mapped a single node to more than one column, you see both mappings in the table. You can set the priority of the mappings using the up and down buttons in the toolbar. This priority is used in cases where the mapping file is used for marshalling and only one column can be marshalled. If the mapping file is used in unmarshalling, the Allora mapping engine is able to update multiple columns in the database.

Node Tree View

Note: When you show mappings for a subtree, you disable the ability to view the line that shows an  element  mapped to a database column.

How to Access the Mappings Tab

The Mappings tab is available when displaying a mapping file in Design View (the default). Double-click a mapping file in the Project Explorer to display Mappings, XML Structure, Table Properties, Table Relations and Predicates tabs.

Use the tabs along the bottom of the  Mapper window to switch between open files.