xml spy
Previous  Top  Next

Creating the mappings


The method described below, is a recapitulation of how to set up the mapping environment.

 

1.Click the Insert XML Schema/File icon.
2.Select the mf-ExpReport.xsd file from the Open dialog box, click Browse... and select the mf-ExpReport.xml file as the XML instance file.
3.Click the expense-report entry, hit the * key on the numeric keypad to view all the items; resize the component if necessary.
4.Click the Insert XML Schema/File icon.
5.Select the ExpReport-combined.xsd file from the Open dialog box.

You are now prompted for a sample XML file for this schema.

6.Click Skip, and select Company as the root element of the target document.

 

       multi-in1

 

The target schema component now appears in the mapping tab.

7.Click the Company entry, hit the * key on the numeric keypad to view all the items, and resize the window if necessary.        

 

       multi-in2

 

Make sure that the "Auto connect child items" icon ic-conn-child is deactivated, before you create the following mappings.

 

Create the following mappings between the two components:

Expense-report to Company
Person to Employee
Last to Name
Title to Title
Phone to Tel.
Email to Email
expense-item to expense-item
Travel to Travel and
Trav-cost to Travel-Cost.

 

       The mapping is shown below.

 

       multi-in3

 

8.Click the Output tab to see the result of the current mapping.

 

       multi-in4

 

Please note:

Empty <expense-item/> tags are generated when child items of a mapped parent item, exist in the source file, which have not been mapped to the target schema. In this case, only the travel items of the expense-item parent have been mapped. There are however, two other expense items in the list: one lodging and one meal expense item. Each one of these items generates an empty parent expense-item tag.

 

To avoid generating empty tags, create a filter such as the one described previously in the tutorial, under Filtering data, or connect the Travel item to the expense-item.


Previous  Top  Next

© 2008 Altova