Home
XML mapping
The XML Mapping editor is a visual data mapping tool that is designed to transform any combination of XML schema, DTD, or XML documents, and produce a deployable transformation document. You can map XML-based documents graphically by connecting elements from a source document to elements from a target document. You can extend built-in transformation functions using custom XPath expressions and XSLT templates. The mapping tool automates XSL code generation and produces a transformation document based on the mapping information you provide.
When mapping between a source XML file and target XML file many different types of mapping transformation can be applied. The simplest is Move, where the values are simply transferred between source and target. Other mapping transformations such as Concat perform more complex processing on the values. The different types of mapping transformation that are available are shown in Table | 0-1.
Table 10-1
Option Description Move This type copies data from a source to a target. Concat This type creates a string concatenation that allows you to retrieve data from two or more entities to link them into a single result. Inline map This type enables the map to call out to other maps, but other maps cannot call it. It can only be used within the current map. If the inputs and outputs are arrays, the inline map is implicitly iterated over the inputs. Submap This type references another map. It calls or invokes a map from this or another map file. Choosing this transform type is most effective for reuse purposes.
Substring This type extracts information as required. For example, the substring lastname, firstname with a "," delimiter and a substring index of 0 returns the value lastname. If the substring index was changed to 1 the output would now be firstname.
Group This type takes an array or collection of data and groups them into a collection of a collection. Essentially, it is an array containing an array. Grouping is done at the field level, meaning that it is done by selecting a field of the input collection such as "department."
Normalize This type normalizes the input string. For example, it can be used to remove multiple occurrences of white space (such as space, tab, or return).
Custom This type allows you to enter custom code or call reference code to be used in the transform. You can extend built-in transformation functions using custom XPath expressions and XSLT templates. Assign This type allows you to assign a constant value to an output element (right-click the output element and select Create transform). Set the value in the Properties view (use single quotes for strings). Available mapping transformations
This section shows an example involving the mapping of two XML schemas. We use the mapping transformations Move, Concat, Inline map, Substring. and Custom.
ibm.com/redbooks