WebSphere Message Brokers
File: ac20425_
Writer: John Prowse

Task topic

This build: July 31, 2007 21:19:24

A note about copying fields

Be aware that, when copying an input message element to an output element, not only the value of the output element but also its type is set to that of the input element. This means that 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 have to include a TYPE clause cast to change the element-type from attribute to Field.

For example, given an input like:
<Field01 Attrib01='Attrib01_Value'>Field01_Value</Field01>
To create an output like:
<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;
Related concepts
Message flows overview
ESQL overview
Related tasks
Designing a message flow
Managing ESQL files
Related reference
Compute node
Database node
Filter node
ESQL reference
SET statement
WHILE statement
CARDINALITY function
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:19:24

ac20425_ This topic's URL is: