Copy parts of inputs: The tree instruction

When dealing with very large documents, it can be time consuming to create DML Blocks that copy parts of the input directly to the output using for each statements. Furthermore, the repetitious execution of these statements consumes processing resources.

To be more efficient, you can use the tree statement to perform blind copies of a sub-tree of nodes from the input to the output. A tree statement is composed of the reserved word tree followed by a path to a node. The node that you reference in the statement can group together other dependent nodes and groups. A tree statement is always the single statement of an expression. This is commonly referred to as tree expressions rather than tree statements.

When you bind a tree expression to an output node, you tell the integration engine to create the output node from a direct and complete copy of the input. If the output node groups other nodes, all expressions bound to those nodes are ignored.

You cannot use tree expressions to copy anything into anything: source and target should share a common structure. Names are not important, only structure. Whatever the names, you can use the tree instruction if:

  • The source (input part that is copied) and the target (output part that is generated) are structured similarly: same number of nodes, with groups being at the same place.
  • Cardinalities are compatible: you can copy a node that is 0..1 into a node that is 0..n while the opposite is not possible.
  • Classes are compatible: when the class of the target is different from the source, implicit conversion must be usable to generate to output from the input.

If all these conditions are verified, the integration engine generates the part of the output from values in the input. Nodes are copied one after another. Groups and occurrences are created so that the final output is the same as the input.

Related Links