arc:map

Version 24.2.9039


arc:map


Use the arc:map keyword to map attributes in one item to attributes in another item. Attributes are read from one item and written to another with the new names specified in the map string. The arc:map keyword does not clear the destination item; it simply adds new attributes to it. If an attribute exists in the destination item, it is overwritten, and other attributes remain as they were.

Parameters

  • to: The name of the item into which attributes are written.
  • from: The name of the item from which attributes are read.
  • map: A list of attribute names that specify the attribute names in the destination item, followed by the attribute names in the source item. For example, you can map attributes with one prefix to attributes with another prefix by using the syntax below:

    customer:\* = soap:\*

    Any characters that are not valid attribute names are ignored and used to demarcate the end of a name.

Control Attributes

None

Examples

Map three attributes: The map is a succession of the to attribute name followed by the from attribute name.

<arc:set item="item1" attr="var1" value="x"/>
<arc:set item="item1" attr="var2" value="y"/>
<arc:set item="item2" attr="attr1" value="z"/>
<arc:map to="item2" from="item1" map="attr1=var1, attr2=var2"/>

In this example, the var1 and var2 attributes of item1 are mapped to the attr1 and attr2 attributes of item2. The attr1 attribute, which is set to the value z in item2, is overwritten with x, the value of var1 from item1. The attr2 attribute, which does not exist in item2, is created and set to y (the value of var2 in item1).

You can map multiple attributes from items with one prefix to items with a different prefix. This is useful when changing the prefix from application prefixes (for example, soap:*) to business domain prefixes (for example, customer:*). The following example creates a mapping from all soap:* attributes in the soapout item to attributes prefixed with customer:* in the customer item:

<arc:map from="soapout" to="customer" map="customer:* = soap:*"/>

Copy all attributes from one item to another item:

<arc:map from="copyfrom" to="copyto" map="* = *"/>

See Also

  • arc:set: Set the attributes of an item.