Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, December 31, 2008

Duplicating Subtrees in XI Message Mappings

Use

Even if elements are shown to occur more than once in the XML instance according to XML Schema definition, they are only displayed once in the structure overview. To assign source fields to multiple positions of an element in the target structure, you can either copy individual elements or the entire subtree using the context menu in the target structure.

Example

The records of a CD catalog are to be mapped to a simple HTML table. There are six subelements of in the source structure that are to be shown in one table line. The target field is only shown once in the structure view, however.

Source Structure (left) and Target Structure (right)

Field Name

minOccurs

maxOccurs

Field Name

minOccurs

maxOccurs

Catalog

1

1

CatalogTable

1

1

cd

0

unbounded

table

1

1

title

1

1

tr

0

unbounded

artist

1

1

td

0

unbounded

country

1

1




company

1

1




price

1

1




year

1

1




Before you can define the target field mapping to the elements, you must first duplicate the element five times using the context menu. Each target field mapping then comprises simply a 1:1 assignment of the source and target fields:

Message Mapping with Duplicated Elements

Target Field Mapping

/CatalogTable=/Catalog

No mapping for/CatalogTable/table

/CatalogTable/table/tr=/Catalog/cd

/CatalogTable/table/tr/td=/Catalog/cd/title

/CatalogTable/table/tr/td[1]=/Catalog/cd/artist

/CatalogTable/table/tr/td[2]=/Catalog/cd/country

/CatalogTable/table/tr/td[3]=/Catalog/cd/company

/CatalogTable/table/tr/td[4]=/Catalog/cd/price

/CatalogTable/table/tr/td[5]=/Catalog/cd/year

Example

Source Instance

Result




Bob Dylan
USA
Columbia
10.90
1985


Bonnie Tyler
UK
CBS Records
9.90
1988

encoding="UTF-8"?>











Empire Burlesque Bob Dylan USA Columbia 10.90 1985
Hide your heart Bonnie Tyler UK CBS Records 9.90 1988

No comments: