Accessing elements within groups in a message in the MRM domain

When an input message is parsed, structures that you have defined as groups in your message set are not represented in the logical tree, but its children are. If you want to refer to or update values for elements that are children of a groups, do not include the group in the ESQL statement. Groups do not have tags that appear in instance messages, and do not appear in user trace of the logical message tree.

About this task

Consider the following Video message:

<Customer xmlns:addr="http://www.ibm.com/AddressDetails" 
xmlns:brw="http://www.ibm.com/BorrowedDetails">
		 <Name LastName="Bloggs">
		 		 <Title>Mr</Title>
		 		 <FirstName>Fred</FirstName>
		 </Name>
		 <addr:Address>
		 		 <HouseNo>13</HouseNo>
		 		 <Street>Oak Street</Street>
		 		 <Town>Southampton</Town>
		 </addr:Address>
             <ID>P</ID>
		 <PassportNo>J123456TT</PassportNo>
		 <brw:Borrowed>
		 		 <VideoTitle>Fast Cars</VideoTitle>
		 		 <DueDate>2003-05-23T01:00:00</DueDate>
		 		 <Cost>3.50</Cost>
		 </brw:Borrowed>
		 <brw:Borrowed>
		 		 <VideoTitle>Cut To The Chase</VideoTitle>
		 		 <DueDate>2003-05-23T01:00:00</DueDate>
		 		 <Cost>3.00</Cost>
		 </brw:Borrowed>
		 <Magazine>0</Magazine>
</Customer>

When the input message is parsed, values are stored in the logical tree as shown in the following section of user trace:

(0x0100001B):MRM = (
  (0x01000013):Name = (
    (0x0300000B):LastName = 'Bloggs'
    (0x0300000B):Title = 'Mr'
    (0x0300000B):FirstName = 'Fred'
  )
  (0x01000013)http://www.ibm.com/AddressDetails:Address = (
    (0x0300000B):HouseNo = 13
    (0x0300000B):Street = 'Oak Street'
    (0x0300000B):Town = 'Southampton'
  )
  (0x0300000B):ID = 'P'
  (0x0300000B):PassportNo = 'J123456TT'
  (0x01000013)http://www.ibm.com/BorrowedDetails:Borrowed = (
    (0x0300000B):VideoTitle = 'Fast Cars'
    (0x0300000B):DueDate = TIMESTAMP '2003-05-23 00:00:00'
    (0x0300000B):Cost = 3.50
  )
  (0x01000013)http://www.ibm.com/BorrowedDetails:Borrowed = (
    (0x0300000B):VideoTitle = 'Cut To The Chase '
    (0x0300000B):DueDate = TIMESTAMP '2003-05-23 00:00:00'
    (0x0300000B):Cost = 3.00
  )
  (0x0300000B):Magazine = FALSE

Immediately following the element named ID, the MRM message definition uses a group which has a Composition of Choice. The group is defined with three children: PassportNo, DrivingLicenceNo, and CreditCardNo. The choice composition dictates that instance documents must use only one of these three possible alternatives. The example shown above uses the PassportNo element.

When you refer to this element in ESQL statements, you do not specify the group to which the element belongs. For example:

SET OutputRoot.MRM.PassportNo = 'J999999TT';

If you define messages within message sets that include XML and TDS physical formats, you can determine from the message data which option of a choice has been taken, because the tags in the message represent one of the choice's options. However, if your messages have CWF physical format, or are non-tagged TDS messages, it is not clear from the message data, and the application programs processing the message must determine which option of the choice has been selected. This is known as unresolved choice handling. For further information, see the description of the value of Choice in Message Sets: Complex type logical properties.