See information about the latest product version
Accessing mixed content in a message in the MRM domain
When you define a complex type in a message model, you can optionally specify its content to be mixed. This setting, in support of mixed content in XML Schema, allows you to manipulate data that is included between elements in the message.
Consider the following example:
<MRM>
<Mess1>
abc
<Elem1>def</Elem1>
ghi
<Elem2>jkl</Elem2>
mno
<Elem3>pqr</Elem3>
</Mess1>
</MRM>
The strings abc, ghi, and mno do not represent the value of a particular element (unlike def, for example, which is the value of element Elem1). The presence of these strings means that you must model Mess1 with mixed content. You can model this XML message in the MRM using the following objects:
- Message
- The message Name property
is set to Mess1 to
match the XML tag.
The Type property is set to tMess1.
- Type
- The complex type Name property
is set to tMess1.
The Composition property is set to OrderedSet.
The complex type has mixed content.
The complex type contains the following objects:
- Element
- The Name property
is set to Elem1 to
match the XML tag.
The Type property is set to simple type xsd:string.
- Element
- The Name property
is set to Elem2 to
match the XML tag.
The Type property is set to simple type xsd:string.
- Element
- The Name property
is set to Elem3 to
match the XML tag.
The Type property is set to simple type xsd:string.
If you code the following ESQL:
SET OutputRoot.MRM.*[1] = InputBody.Elem3;
SET OutputRoot.MRM.Elem1 = InputBody.*[5];
SET OutputRoot.MRM.*[3] = InputBody.Elem2;
SET OutputRoot.MRM.Elem2 = InputBody.*[3];
SET OutputRoot.MRM.*[5] = InputBody.Elem1;
SET OutputRoot.MRM.Elem3 = InputBody*[1];
the mixed content is successfully mapped to the following output message:
<MRM>
<Mess1>
pqr
<Elem1>mno</Elem1>
jkl
<Elem2>ghi</Elem2>
def
<Elem3>abc</Elem3>
</Mess1>
</MRM>