Table of Contents

Search

  1. Preface
  2. Introduction to Data Transformation
  3. Data Processor Transformation
  4. Wizard Input and Output Formats
  5. Relational Input and Output
  6. XMap
  7. Libraries
  8. Schema Object
  9. Command Line Interface
  10. Scripts
  11. Parsers
  12. Script Ports
  13. Document Processors
  14. Formats
  15. Data Holders
  16. Anchors
  17. Transformers
  18. Actions
  19. Serializers
  20. Mappers
  21. Locators, Keys, and Indexing
  22. Streamers
  23. Validators, Notifications, and Failure Handling
  24. Validation Rules
  25. Custom Script Components

Data Transformation User Guide

Data Transformation User Guide

Mapping Statements in the Example

Mapping Statements in the Example

Use the grid area of the XMap editor to define statements that map the input XML elements to the output XML elements. Create and edit mapping statements in the grid. Define the context, condition and expected input and output for a mapping statement. You can add variables to mapping statements.
The following figure shows the mapping statements in the grid:
The XMap editor grid shows a series of mapping statements and their dependencies. All the statements in the XMap are nested under a Repeating Group statement named Company. The Company statement provides the context for all of the logic in the XMap. The Company statement contains nested Map, Router and Repeating Group statements. The grid displays the parameters in each statement. The statement parameters determine the logic of the statement.
The grid contains the following mapping statements:
Grid row 1, Repeating Group statement named Company
The Company statement is a Repeating Group statement. It repeats for each the Company element. The statement provides a context for the rest of the statements in the grid. For each company, the Data Processor transformation evaluates the child statements.
Grid row 2, Repeating Group statement named Department
The Department statement is a Repeating Group statement. It repeats for each Department element. The statement provides a context for the rest of the statements in the grid. For each department, the Data Processor transformation evaluates the child statements.
Grid row 3, Map statement named NametoDepartment
The NametoDepartment statement is a Map statement. It maps the Name element to a variable $deptName.
Grid row 4, Repeating Group statement named MatchOrganization
The MatchOrganization statement is a Repeating Group statement. It has an output expression:
tns0:Organization[tns0:Department=$deptName]
The statement finds the Organization element in the output that contains a Department child element with the value in $deptName. Or, if the Department element does not exist, the element is created.
Grid row 5, Repeating Group statement named EmployeeToWorker
The EmployeeToWorker statement is a Repeating Group statement. It repeats for each Employee element.
Grid row 6, Router statement named Employee
The Employee statement is a Router statement. The statement has no input or output.
Grid row 7, Option statement named EmployeeToMgr
The EmployeeToMgr statement is an Option statement. The Option statement contains the following condition:
tns0:Role="Manager"
.
When the Role is Manager, the statement is true, and the Data Processor transformation evaluates the statements nested inside the Option statement.
Grid row 8, Run XMap statement named EmployeeToWorker
The EmployeeToWorker statement is a Run XMap statement. It calls the XMap_EmployeesToRoles XMap to pass the Employee elements to the Manager type.
Grid row 9, Default statement named EmployeeToWorker
The EmployeeToWorker statement is a Default statement. The Data Processor transformation performs the child statements when the employee role is not a manager.
Grid row 10, Run XMap statement named EmployeeToWorker
The EmployeeToWorker statement is a Run XMap statement. It calls the XMap_EmployeesToRoles XMap to pass the Employee elements to the Worker type.
Grid row 11, Map statement named IncrementEmployeeCount
The IncrementEmployeeCount statement is a Map statement. It calls the Data Processor transformation to add 1 to @noOfEmployees for each Employee that it iterates. The Map statement contains the following input expression:
dp:output()/@ noOfEmployees + 1
.