IBM Integration Bus, Version 10.0.0.2 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS


A note about copying fields

When you copy an input message element to an output element, the value and type of the output element is set to that of the input element. Therefore, if, for example, you have an input XML document with an attribute, and you want to set a Field element (rather than an attribute) in your output message to the value of the input attribute, you must include a TYPE clause cast to change the element-type from attribute to Field.

About this task

For example, given the following input:
<Field01 Attrib01='Attrib01_Value'>Field01_Value</Field01>
To create an output, such as in the following example:
<MyField_A MyAttrib_A='Attrib01_Value' MyAttrib_B='Field01_Value' >
		<MyField_B>Field01_Value</MyField_BC>
		<MyField_C>Attrib01_Value</MyField_C>
	</MyField_A'>
You would use the following ESQL:
-- Create output attribute from input attribute
SET OutputRoot.XMLNSC.MyField_A.MyAttrib_A = InputRoot.XMLNSC.Field01.Attrib01;
-- Create output field from input field
SET OutputRoot.XMLNSC.MyField_A.MyField_B = InputRoot.XMLNSC.Field01;

-- Create output attribute from input field value, noting we have to 
-- "cast" back to an attribute  element
SET OutputRoot.XMLNSC.MyField_A.(XMLNSC.Attribute)MyAttrib_B = 
               InputRoot.XMLNSC.Field01;

-- Create output field from input attribute value, noting we have to 
-- "cast" back to a field element
SET OutputRoot.XMLNSC.MyField_A.(XMLNSC.Field)MyField_C = 
               InputRoot.XMLNSC.Field01.Attrib01;

ac20425_.htm | Last updated 2015-09-24 12:51:35