In the Annotated XML Schema view of the IBM XML Schema Mapping Designer,
you define the association between elements and attributes in
an XML schema and columns in one or more tables in a DB2® relational
database. The relationship between an element or attribute and
column is defined by a map link. You can specify values for the
properties that are associated with each map link.
Mapping Editor
In this section, you define the links that map elements and
attributes in an XML schema document to columns in the relational
database.
The editor is divided into two panes.
The left pane, which is the source pane, is named
Source XML schema. This pane is not
shown unless an XML schema document is open in the
editor. This pane shows a tree representation of the
elements and attributes that are in the root node of
the XML schema that you selected for mapping.
When an element or attribute is selected in this pane,
the W3C standard properties of the element or attribute
are shown in the Properties section.
You can change the size of this pane. Click the pane
header to display the pane sizing handles, and then
drag the appropriate sizing handle to increase or
decrease the pane size.
The right pane, which is the target pane, shows the
database tables that contain columns to which you want
to map elements and attributes in the XML schema.
You can collapse or expand a table graphic that is
displayed in this pane by double-clicking the table
header.
A map link is shown as a blue line between a source node
(element or attribute) in the XML schema and a target column
in the relational database.
Use the commands on the shortcut menu to work in the editor.
Add Map Link
Lets you define a relationship between an element or
attribute in the XML schema and a column in one of
the database tables that is displayed in the editor.
You can also add a map link by dragging from a source
XML element or attribute to its target column.
Add Target Table
Opens the Add Table
window, where you can select one or more database tables
to display in the editor.
Add XSD Source
Opens the
Select XML
Schema Source window, where you can select the XML
schema document (XSD) that you want to annotate.
Remove Map Link
Removes the map link that is selected in the editor.
Remove Target Table
Removes the table that is selected in the editor. All
map links to columns in the table are also removed.
Hide selected
Hides from display the table or map link that is selected
in the editor. If you hide a map link, only the portion
of the map link that is outside the Source XML schema pane
is hidden from display. If you hide a table, all the map
links to columns in the table are also hidden.
Show All
Displays all the tables and map links that you have hidden
previously.
View Source
Lets you review the annotated XML source that is generated
for the mapped elements and attributes. You can open the
XML source in the Visual Studio text editor or in the Visual
Studio XML designer.
Zoom
Enlarges or reduces your view of the XML schema document and
database tables in the editor. You can select one of the
following zoom factors: 100%, 75%, 50%, and 33%.
Test
Opens the Test Form
window, where you can test the relationships in the
annotated XML schema by loading an XML document against
the schema. This command is available only after you have
saved the annotated XML schema and registered it in the
XML Schema Repository.
Properties
In this section, you specify values for the properties of
the map link that is selected in the Mapping
Editor section. Click a map link to select it.
A selected map link has a handle at the right perimeter
of the Source XML Schema pane and another
handle at the right end of the link where it connects to a
column.
SourceDataType
Shows the data type of the source XML element or attribute
in the XML schema document.
SourceLocation
Shows the XPath location of the source XML element or
attribute in the XML schema document.
TargetDataType
Shows the data type of the target column in the database.
TargetLocation
Shows the location of the target column in the database.
The notation for the location is:
/<database name>/<schema name>/<table name>/<column name>
Content Handling
Indicates how to process the data content of an element.
Choose one of the following values for this property:
stringvalue
The data to be inserted into the database is the
concatenation of the character data of the element
and the character data of the element's descendants,
in document order.
This is equivalent to the string that appears
between the element's start and end tags after
all comments, processing instructions, and
descendants' start and end tags have been removed.
text
The data to be inserted into the database is the
concatenation of the character data (including CDATA
section, excluding comments and processing instructions)
within the element, excluding any children elements
(their start and end tags and any content that appears
between those tags).
serializeSubtree
Everything that appears inclusively between the start and
end tags of the element in the instance document, is
serialized as character data for insertion into the
column to which the element is mapped. Comments and
processing instructions are included in the serialized
text.
Normalization
Indicates how to normalize the XML input data for this element
or attribute. Choose one of the following values for this property:
whitespaceStrip
The XML value that is to be inserted into the column,
is first stripped of leading and trailing white space.
canonical
The XML value is put into the canonical representation
according to its XML schema type.
original
Instructs the decomposition process to insert using the
original character data (subject to any parser processing)
of the element content or attribute value from the input
XML document.
Condition
Use this field to define a conditional mapping expression.
The map link is created only when the condition is True.
A condition is a subset of the SQL search condition.
Create or edit your conditional mapping expression in this
field, or click
and then create or edit your conditional
expression in the
Condition window.
For help with the syntax of a condition,
press Ctrl + Spacebar in the Condition window.
Expression
Use this field to define an expression whose value is inserted
in the database instead of the XML value from the source
document. The expression can be any valid DB2 expression
that contains the value of the source node.
Create or edit your expression in this field, or click
and then create or edit your expression
in the Expression window.
For help with the syntax of an expression,
press Ctrl + Spacebar in the Expression window.
Truncate
If this value is True, XML data can be truncated when it is
inserted into or updated in the target column.