The mapping editor generates Java source code from the graphical description of the message mapping. This section gives you an overview of how the generated Java source code processes an XML source structure at runtime.
In the mapping editor you assign the fields of two XML structures to each other. Note that at runtime no target structure exists prior to the mapping. The target structure is only generated when the mapping is executed.
The message mapping must therefore generate the target structure at runtime. Two things determine how the target structure looks after it has been generated:
· The number and type of tags which exist in the source structure instance
· How often the target fields are specified to occur in the target structure
In both cases, this in turn depends on the value for Occurrence that you specified in the type definition in the XSD editor. The values for are mapped to the XSD attributes minOccursand maxOccurs. You can display these attributes in the tabular tree view. minOccursspecifies the minimum number of times a tag must occur, while maxOccurs specifies the maximum number of times a tag may occur. The root node occurrence is minOccurs=maxOccurs=1 in both the source structure and target structure.
If the occurrence of a tag in the source or target structure is not explicitly specified, the mapping editor makes this visible to the user. These default values correspond to the XSD specification (minOccurs=“1“, maxOccurs=“unbounded“).
XML structures are ordered hierarchically. Therefore, in an XML instance a field is always in a context of the higher-level field. For example, in the following XML instance the <flat> fields are in the <street> context and the <city> fields are in the <root> context.
The message mapping processes the source structure and generates the target structure according to the target field restrictions and according to the target field mappings linked to the target fields. The processing procedure is intuitive for simple occurring fields. To understand the processing, you need to differentiate between two levels: