WebSphere Message Brokers
File: ak05141_
Writer: Bill Oppenheimer

Task topic

This build: July 31, 2007 21:31:38

Working with elements of type list

The XML Schema specification allows an element, or attribute, to contain a list of values that are based on a simple type, with the individual values separated by white space. In the message tree, an xsd:list element is represented as a name node, with an anonymous child node for each list item. Repeating lists can be handled without any loss of information.

Consider the following XML input message:
 <message1>
   <listE1>one two three</listE1>
 </message1>
This XML element produces the following message tree:
 MRM
	listEl  (Name)
		"one"   (Value)
		"two"   (Value)
		"three" (Value)

Individual list items can be accessed as ElementName.*[n].

For example, use the following ESQL to access the third item of listE1:
 SET X = FIELDVALUE (InputBody.message1.listE1.*[3]);

An attribute can also be of type xsd:list.

Consider the following XML input message:
 <message1>
	<Element listAttr="one two three"/>
 </message1> 
This XML element produces the following message tree:
 MRM
	Element	(Name)
		listAttr	(Name)
			"one"	(Value)
			"two"	(Value)
			"three" (Value)

As before, individual list items can be accessed as AttrName.*[n].

For example, use the following ESQL to access the third item of listAttr:
 SET X = FIELDVALUE (InputBody.message1.Element.listAttr.*[3]);

A list element can occur more than once.

Consider the following XML message:
 <message1>
	<listE1>one two three/listE1>
	<listE1>four five six/listE1>
 </message1> 
The message tree for this XML message is:
 MRM
	listE1	(Name)
		"one"	(Value)
		"two"	(Value)
		"three" (Value)
	listE1	(Name)
		"four"	(Value)
		"five"	(Value)
		"six" (Value)
Code the following ESQL to access the first item in the second occurrence of the list:
 SET X = FIELDVALUE (InputBody.message1.listE1[2].*[1]);
Related tasks
Developing ESQL
Accessing elements in the message body
Mapping between a list and a repeating element
Related reference
SET statement
Notices | Trademarks | Downloads | Library | Support | Feedback

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

ak05141_ This topic's URL is: